Section 1 - Introduction
Section 2 - Basics
Section 3 - Next Level
Section 4 - Advanced
Forms
How forms are sent
Input field
Buttons
Input types
Fieldset
For more help...
You try it
Advanced Tables
Frames
Style Sheets
Image Maps
Section 5 - Publishing
Section 6 - Extras
Appendices
|
Checkbox:
Another type of input tag is the check box. This allows your user to click on a box and send you the information. this also goes in the input tag. It looks like this:
-
<input type="checkbox">
It is also recommended that a name be given to the checkbox. This is important when you receive the information, you'll want to know what was checked. That's easy to add.
-
<input type="checkbox" name="cat">
Let's say you want to know what type of animals people have as pets. Checkboxes would be ideal. Here's an example of how to use them.
Code |
---|
<form method="POST" action="mailto:myaddress@mail.com">
What kind of animal makes the best companion? <br>
<input type="checkbox" name="cat"> Cat <br>
<input type="checkbox" name="dog"> Dog<br>
<input type="checkbox" name="bird"> Bird<br>
<input type="checkbox" name="fish"> Fish<br>
<input type="text" name="other" size="10"> Other<br>
<input type="submit" value="Talk to me"> <br>
<INPUT TYPE=RESET value="Clear it">
</form>
|
|
|
There is one more thing you can do with check boxes. You have have them checked even before someone visits your site. To pre-check a box, here's what you do:
-
<input type="checkbox" name="dog" CHECKED>
This will provide one answer (or as many as you list) to be checked. Let's look at the list we had before, only let's make "dog" pre-checked.
Code |
---|
<form method="POST" action="mailto:myaddress@mail.com">
What kind of animal makes the best companion? <br>
<input type="checkbox" name="cat"> Cat <br>
<input type="checkbox" name="dog" CHECKED> Dog<br>
<input type="checkbox" name="bird"> Bird<br>
<input type="checkbox" name="fish"> Fish<br>
<input type="text" name="other" size="10"> Other<br>
<input type="submit" value="Talk to me"> <br>
<INPUT TYPE=RESET value="Clear it">
</form>
|
|
|
That's how to put checkboxes on a page. They're useful if you want to give the user options, especilly if they can pick more than one. Next, we go to radio buttons. Yeay.
- Text
- Checkboxes
- Radio Buttons
- Passwords
- Hidden
- File
- Image
- Textarea
- Select and Option
|