Page 1 of 1

php radio

Posted: Tue Aug 08, 2006 8:16 am
by shiranwas
hi,

i have a field called "rejected" in a table datatype enum('N','Y')
i want to check a radio button if the value is 'Y' how to do this

this is my html tag for radio button

<input name="optFrom" type="radio" value="Rejected" >



thanks

shiran

Posted: Tue Aug 08, 2006 9:09 am
by feyd
Set the value attribute. Check it like another other form field.

Posted: Tue Aug 08, 2006 4:00 pm
by pickle
If you're checking or not checking the radio depending on the value in the database, you're going to need to set the 'checked' attribute.

Code: Select all

$checked = ($whateverYourDatabaseValue == 'Y') ? "checked = 'checked'" : '';

echo <<<RADIO
<input name = "optFrom" type = "radio" value = "Rejected" $checked />
RADIO;

Posted: Wed Aug 09, 2006 2:51 am
by shiranwas
it 's working
thanx