Jump to content

How to set field sorting criteria using a dropdown menu


ed01

Recommended Posts

Hi guys,
The problem I'm having below is related to html output from a drop-down menu with the multiple option. I tried posting into the php/mysql section, got 16 reads but no one offered any help - maybe it's more html??
Anyway, here's what's got me stumped....
I'm having difficulty getting my retrieved database data to display the way I need. I would like to be able to choose the fields to filter out  and I'm using a drop-down menu to do so. It works fine except that instead of displaying all of the chosen fields, it only displays the field coresponding to the LAST item in the drop-down list (rather than ALL the selected ones). I should be able to use Ctrl-click to select the fields I want to display. Here's the relevant code. I hope it's enough.
Any help would be greatly appreciated!

$querycolumns = $_POST['showcolumns'];
$query  = "select {$querycolumns} from momentum_apex";


// Select a sorting criteria.
$HTML=<<<HTML
<form action="{$_SERVER['PHP_SELF']}" method="post">
  <select name="showcolumns" size="3" multiple="multiple">
    <option value="role">role</option>
    <option value="first_name">first_name</option>
    <option value="last_name">last_name</option>
  </select>
  <input name="filter" type="submit" value="Filter now!" />
  </form>

HTML;
echo $HTML;
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.