HTML Forms :
CHECK BOX








Check boxes are used when you want to let the visitor select one or more options from a set of alternatives. If only one option is to be selected at a time you should use radio buttons instead.





SETTINGS:

Below is a listing of valid settings for check boxes:


HTMLEXPLANATIONEXAMPLE
checkbox
  name=
  value=
  align=
  tabindex=
checked

Choose one or more options
Name of the field.
Value that is submitted if checked.
Alignment of the field.
Tab order of the field.
Default check this field.




The name setting adds an internal name to the field so the program that handles the form can identify the fields.

The value setting defines what will be submitted if checked.

The align setting defines how the field is aligned.
Valid entries are: TOP, MIDDLE, BOTTOM, RIGHT, LEFT, TEXTTOP, BASELINE, ABSMIDDLE, ABSBOTTOM.
The alignments are explained in the image section. You can learn about the different alignments here.

The tabindex setting defines in which order the different fields should be activated when the visitor clicks the tab key.




AN EXAMPLE:

Look at this HTML example:
<html>
<head>
<title>My Page</title>
</head>
<body>
<form name="myform" action="http://www.mydomain.com/myformhandler.cgi" method="POST">
<div align="center"><br>
<input type="checkbox" name="option1" value="Milk"> Milk<br>
<input type="checkbox" name="option2" value="Butter" checked> Butter<br>
<input type="checkbox" name="option3" value="Cheese"> Cheese<br>
<br>
</div>
</form>
</body>
</html>


And the resulting output from it:

Milk
Butter
Cheese



 << PREVIOUS
READ MORE >>  
















DEVELOPER TIP!





     "Better Than Books - As Easy As It Gets!"