Page 1 of 1

Drop Down Options

Posted: Tue Jan 06, 2009 12:33 pm
by SheDesigns
:?
I need a clue building a drop down menu that has pre-existing options, AND pull any additional options from the table. So it kind of looks like this:

Please Select One: [ Pick your Option [v]]
OR Create New Option - [ ]

<option value="a">Option A</option>
<option value="b">Option B</option>
<option value="c">Option C</option>

An option to pick A, B, or C needs to always exist on the menu - even if no current records use these.
However, if they add a new option, "Option Z", I want Option Z to show on the menu - not only for the record that uses Option Z, but any future records to be able to pick Option Z from the dropdown menu.

Here's what I have so far, however it only works on the record where Option Z is selected. Other records can't select Option Z from their dropdown menu. I don't understand. Also, they need the options in alphabetical order! I was thinking of creating a seperate table for these options, but I have about 6 drop down that need to be worked like this, so it's a little unrealistic.

Code: Select all

$query = "select 'options' from table where category != 'a' or 'b' or 'c'; ";
$result = mysql_query($query);
$fetch  = mysql_fetch_array($result);
{
extract($fetch);
  echo "<option value="$options'>$options</option>";
}
Simple, but it only works on the record that has the new category. No other records will show this.

Re: Drop Down Options

Posted: Tue Jan 06, 2009 1:21 pm
by VladSun
Could you please, post the details of your DB design.