Introduction
Text
Formatting
Links
Lists
Images
Tables
Frames
Forms
Interacting with Forms
Form Tag
Text
Checkbox
Radio
Password
Hidden
Submit
Image
Reset
Select
Textarea
Conclusion


Input Tag: Checkbox
The checkbox field is a small box that you can check. They are used when you want to give a set of options, and the user can select more than one if he/she chooses. If you want to make sure that only one option can be selected then you should use the radio buttons. The basic checkbox field code will look like this:

<INPUT TYPE="checkbox">

You can further customize it by adding more attributes to the <INPUT> tag.

The VALUE attribute sends it's value to the CGI script only if it was checked.

The NAME attribute assigns a name to this input field. If you have a set of checkbox fields that should be grouped together then you will want to name them all the same name.

The CHECKED attribute does not have a value and it will place a check in the box as the default.

The TABINDEX attribute specifies the order in which the field will be activated by pressing the tab button.

Here is an example of a complete checkbox field:

<FORM ACTION="#">
What kind of toppings do you like on your pizza?<BR>
<INPUT TYPE="checkbox" NAME="pizza" VALUE="pepperoni" TABINDEX="2"> Pepperoni<br>
<INPUT TYPE="checkbox" NAME="pizza" VALUE="mushrooms" TABINDEX="1" CHECKED> Mushrooms<br>
<INPUT TYPE="checkbox" NAME="pizza" VALUE="anchovies" TABINDEX="4"> Anchovies<br>
<INPUT TYPE="checkbox" NAME="pizza" VALUE="pineapple" TABINDEX="3"> Pineapple
</FORM>


Here is how it will look:

What kind of toppings do you like on your pizza?
Pepperoni
Mushrooms
Anchovies
Pineapple
back  next

© Copyright 2000-2002 by Pepmint.com. All Rights Reserved

Search Pepmint.com

home :: tutorial :: portfolio :: links :: hammies :: guestbook :: contact