Dropdownmenu SELECTED value as per value return fromDB
Posted
by
Faizan Qadri
on Stack Overflow
See other posts from Stack Overflow
or by Faizan Qadri
Published on 2012-04-13T17:19:13Z
Indexed on
2012/04/13
17:31 UTC
Read the original article
Hit count: 243
php
|JavaScript
All i am trying to do is to set the selected value of drop down menu according to the particular value returned from the database
like if person saved his gender as 'Male' and he wants to update his profile then the selected option shown on the Gender's dropdown llist should be shown as Male cause if this doesn't happen 'Poor guy becomes a female due to this small problem in my code' KINDLY HELP!!!!!!!
MY Current Code:
<select name="Gender" id="Gender">
<option selected="selected"><?php echo $row_Recordset1['Gender']; ?></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
The above code work fine but causes repitition of values in dropdown like Male Male Female
© Stack Overflow or respective owner