PHPSuperBlog.com

HTML form element – Radio button

Like drop down menu, radio button element almost work the same but allows the users to see all the selections once the web page loads. 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:

one

two

three

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.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Similar Posts:

Leave a comment