RE: [PHP] radio buttons checked or not
| From: | Jay Blanchard | Date: | Wed, 07 Apr 2004 14:39:46 +0000 |
| Subject: | RE: [PHP] radio buttons checked or not | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182640@lists.php.net to get a copy of this message | ||
[snip]
i have this code:
<?if($old['Type']=="Annual"){?>
<input type="radio" name="eventtype" value="Annual"checked
accesskey="y">Yes
<?}else {?>
<input type="radio" name="eventtype" value="OneTime" checked
accesskey="n">No<?}?>
was just wondering if that was the right way to determine the state of a
radio button...?
if the value of $old['Type']="Annual" then the yes button is
checked...if
not then the no button is checked instead...
[/snip]
Check for the value assigned to each
if("Annual" == $_POST['eventtype']){
... do stuff ...
} elseif("OneTime" == $_POST['eventtype']){
... do other stuff ...
}