Page 73 - Modular_V1.1_Flipbook
P. 73
Adding text box
Adding a Radio Button
Radio buttons are used when the user has to make a selection among multiple choices or option.
It is generally used for selection of gender, quiz questions, etc. For example, for accepting the
gender the programmer needs to specify two radio buttons “Male” and “Female”, which belong
to the same group called “Gender” so that while inputting data a user will be able to select either
“Male” and “Female” but not both.
Syntax:
<INPUT TYPE= “RADIO” NAME=“Gender” VALUE=“Male” CHECKED> Male
<INPUT TYPE=“RADIO” NAME=“Gender” VALUE=“Female”> Female
TYPE=“RADIO” indicates that the form element is radio button.
NAME=“Gender” is the name of the radio button group.
VALUE=“Male” and VALUE=“Female” signifies that one radio button has value “Male” and the
other has the value=“Female”.
CHECKED attribute selects the specific radio button by default. Here, ‘Male’ radio button is
checked by default.
<HTML>
<BODY>
<FORM>
Gender :
<INPUT TYPE="RADIO" NAME="Gender" VALUE="Male" CHECKED> Male
<INPUT TYPE="RADIO" NAME="Gender" VALUE="Female"> Female
</FORM>
</BODY>
</HTML>
Forms in HTML 71

