I have a select box where the user chooses a sex (gender) from a drop down, and their choice is specified with "selected" in the select tag. But the box always ends up 'Choose'. What is wrong in the following syntax?
echo"<select name='sex'>
<option value='N' '". ($info['sex'] == "N" ? 'selected=selected':'') ."'>Choose</option>
<option value='M' '". ($info['sex'] == "M" ? 'selected=selected':'') ."'>Male</option>
<option value='F' '". ($info['sex'] == "F" ? 'selected=selected':'') ."'>Female</option>
</select>";
The $info['sex']
is from a consult SQL that return always N, M or F.