Form: Radio Input
The following line defines a radio button. Radio buttons let users select ONE of a limited number of choices:
<input type="radio">
HTML file: |
Displayed by browser: |
<form>
Gender: <br />
<input type="radio" name="sex" value="male" checked>Male
<br />
<input type="radio" name="sex" value="female">Female
<br /><br />
<input type="submit">
</form>
|
|
Notes:
- By adding the "checked" attribute to the input tag, the radio button will be pre-selected on the form.
- When you apply the "name" attribute, it helps to store the information under that particular category (in this case, under sex), at the server where the database resides.
- When you click on the submit button, it will not go to a form-handler, because there is no "action" attribute in the <form> tag, which would contain the URL where the data is to be sent to.