[liphp] problem populating radio button fields
Venkatagiriyappa, Veena
[email protected]
Mon, 23 Jun 2003 13:07:28 -0400
Hi,
I have few fields which are of type "radio button" in my html form. I need
to populate those with the values from database. But, with the below code
it;s not doing correctly.
[code]
<td>Experiment type:</td>
<td>
<input type="radio" name="expt" value="MAD"
<?if($proposal_data[7]=="MAD")?>checked="checked">MAD
<input type="radio" name="expt"
value="SAD"<?if($proposal_data[7]=="SAD")?>checked="checked">SAD
<input type="radio" name="expt" value="Single Wavelength"
<?if($proposal_data[7]=="Single Wavelength")?>checked="checked">Single
Wavelength </td>
[/code]
$proposal_data[7] contains the value from the database. If I print it
seperately, it's giving me the correct value which is 'Yes' or 'No'
But in the form, the last field in this case 'Single Wavelength' is checked
by default which is incorrect in some cases(depending on the row retreived
from the database).
I would appreciate if someone can figure out the possible problem in the
above method.
-Veena