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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.