HTML form element – Radio button

Posted by Shek on May 2, 2008 under HTML | Be the First to Comment | Total View: 4,437 views

Like a drop down menu, radio button element almost work the same but allows the users to see all the selections in a list. I use the radio button for member registration area in my past work to let them to choose things such as gender or age group etc.

Here is an example:

<input type="radio" name="number" value="1"> one
<input type="radio" name="number" value="2"> two
<input type="radio" name="number" value="3"> three

We get:

Remember to give them the same name to indicate that they are all belong to the same set of radio button.

Attributes for the radio button:

  • name: to give the radio button set a name.
  • type: to indicates that it is a radio button, by using “type=”radio””.
  • value: the value which will send to a PHP file for processing after being submit, please aware that this is different from the text display.

Please notice that only 1 choice can be selected in a set of radio button.

Not what you want? Try a Search

Add A Comment