I have a problem about data stored in database. I want to select data that was fetch from database and show in drop down menu. for example I have "age" field in database and I have drop down menu.and I stored "20" in this field in database and when I fetch this I want "20" to be selected in select tag.(value="20" selected="selected') and user can edit this.It means user can click on drop down menu and sees other options but the selected option is the data that was fetch from database.
I tried this but it doesn't work:
<select>
<option <? if($detail['age']==19) {?> selected="selected" <? } ?> >19</option>
<option <? if($detail['age']==20) {?> selected="selected" <? } ?> >20</option>
<option <? if($detail['age']==21) {?> selected="selected" <? } ?> >21</option>
</select>
HELP ME!!!