PHP and drop-down lists


I want to have a simple option box

<select name="blah_1">
    <option name="option_1" value="option_1" selected="true">
    <option name="option_2" value="option_2" selected="false">

to have a value automatically selected according to the values in the database.

For example, in the database, if I have a field named “field_1”, and one row has the value of “option_1”, I want “option_1” to be selected. How would I go about doing that?


if u get ur query inside an array:
[php]$result=mysql_query(‘SELECT …’);

u may use a function from: (second post)

echo makeselect (‘blah_1’, $blahs_values, $row[‘field_1’])[/php]


Ok, cool. I check it out. Thanks.


Did it work?



Yep. It worked wonderfully. Thank you.