Hi everyone,
I am trying to automatically select a value in a pulldown menu based on the result of a SQL query.
For example if I have:
[code=php]$row[‘test’] = “mike”
and…
[code=html]<select name=”test”>
<option value=”joe”>Joe</option>
<option value=”chris”>Chris</option>
<option value=”mike”>Mike</option>
</select>
how can I have Mike selected when the page loads?
I know you can select any of these using javascript selectedIndex, but is there a way to select by the text value since this is the data stored in the Database?
Basically I need a script that if the value is set to “mike” it selects mike (the equivilent of selectedIndex[2] in JS). The selection list in question is huge (over 100 records and changes often).
Thanks!