Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- MySQL Results into drop down menu
April 28, 2005, 4:15 pm
rate this thread
I have a site populates a drop down menu with options, say...
If i customer is currently set to Option 3, i'd like this to be at the
top of the Drop down menu and therefore the default option.
This seems like a pretty simple thing but their doesn't seem to be a
Can anyone advise me on how to best deal with this?
Thanks in advance.
Re: MySQL Results into drop down menu
when php is populating your options (done by a loop, i figure), you
just need an if statement to print selected="selected" for the default
option, like that:
$options = 'option0';
$options = 'option1';
$options = 'option2';
$options = 'option3';
foreach($option as $key => $value)
if($value == $default)
print " selected=\"selected\"";