Radiobuttons are used in groups of two or more to allow the user to select one of a set of mutually exclusive choices. Setting one radiobutton in a group automatically clears the others in the group.
The radiobuttons in a group are defined separately, one
per input tag. All radiobuttons in
a group must, however, have the same
name="
value.fieldName"
<input type="radio" name="fieldName" value="choiceText" checked>
where:
fieldNameis an internal name that will be passed to the downstream CGI script as the name of this element. All radiobuttons in the same group must have the same value for this attribute.
choiceTextwill be passed to the downstream CGI script as the value of this field, if this particular radiobutton is selected.
checkedis optional; specify this attribute in the radiobutton that you want to be set (on) when the form is initially displayed.
If none of the radiobuttons in a group have the
checked attribute, none of the
radiobuttons will be set initially. If the
user of the form doesn't then select any of them, the
downstream CGI script will not receive a
(name,value) pair for that group. To avoid this
situation, always specify one of the radiobuttons
as checked; once one of the
radiobuttons has been set in a form, there is no
way for the user to clear them
all.