Check Box
Check boxes are useful when you want to give the user the option to select one or more choices. We can have one already checked by using the CHECKED attribute.The format for check boxes is:
<INPUT TYPE="checkbox" NAME="value">value
For example:
Type of pet(s) you have:<BR>
<INPUT TYPE="checkbox" NAME="dog" CHECKED>Dog
<INPUT TYPE="checkbox" NAME="cat">Cat
<INPUT TYPE="checkbox" NAME="fish">Goldfish
<INPUT TYPE="checkbox" NAME="hamster">Hamster
In a browser, this would look like:
Type of pet(s) you have:
Dog
Cat
Goldfish
Hamster
Notice that "Dog" is already checked. The CHECKED attribute is optional. We do not have to pre-check any of the check boxes.
Now you try it: