Radio Buttons
Radio buttons are useful when you want your user to be able to select one, and only one, choice from a set of predetermined options.Radio is very similar to check boxes, but uses one additional attribute -- the VALUE attribute. Note also that the NAME attribute must be the same for all of the Input tags in the same group.
The format for a radio input tag is:
<INPUT TYPE="radio" NAME="value" VALUE="data">
NAME identifies each radio button in the set. VALUE is the text that will be sent to the server if the button is checked. As with check boxes, we can use the CHECKED attribute to have one value pre-selected.
Look at the following example:
Choose your favorite operating system:<BR>
<INPUT TYPE="radio" NAME="os" VALUE="L" CHECKED>Linux
<INPUT TYPE="radio" NAME="os" VALUE="W">Windows
<INPUT TYPE="radio" NAME="os" VALUE="O">OS2
<INPUT TYPE="radio" NAME="os" VALUE="B">FreeBSD
In a browser this looks like:
Choose your favorite operating system:
Linux
Windows
OS2
FreeBSD
Now you try it:
Isn't this fun? Let's try a menu!