getting default value for radio button from query [SOLVED]
Posted: Sat Sep 15, 2007 9:58 am
hello, I am trying to get the default value selected in a set of two radio buttons from my query results, I would have expected the following to work:
The data type for sex is enum, with 'm' or 'f' as possible values.
the html I am getting from this code has both radio buttons set as "checked".
any help is apprectiated.
Code: Select all
echo ' <td>
<label>
<input type="radio" name="sex" ' ;
if ($row['sex'] = 'f') {echo 'checked ="checked" ' ;}
echo 'value="f" />
Female</label>
<br />
<label>
<input type="radio" name="sex" ' ;
if ($row['sex'] = 'm') {echo 'checked ="checked" ' ;}
echo 'value="m" />
Male</label>
</td>'the html I am getting from this code has both radio buttons set as "checked".
any help is apprectiated.