Answers Search Help
Boston University home page
Forms: Introduction
 
 
 
 
    HTML Elements
 
 
 
 
 
 
 
    PonyExpress
 
 
 
 
    Form to E-mail
 
 
 
 
    Form to Datafile
 
 
 
 
    Form to Web Page
 
 
 
 
    Also See
   
 

Checkboxes

You should use checkboxes for fields whose values can be one or more of a predefined set of values. By giving each checkbox the same NAME attribute, the data will be sent as a list of values if multiple boxed are checked. Like text fields, the checkbox uses the <input> tag, with a TYPE of "checkbox":

<input type="checkbox">

Each checkbox should also have a VALUE attribute. This is the data that will actually be sent to PonyExpress for your checkbox field, not the text visible on the page. To have a checkbox default to an already-checked state, add the "CHECKED" keyword inside the INPUT tag.

For example:

Please contact me by:<br>
<input type="checkbox" name="contact" value="email"> E-mail <br>
<input type="checkbox" name="contact" value="phone"> Phone <br>
<input type="checkbox" name="contact" value="snail"> U.S. Mail <br>
<input type="checkbox" name="contact" value="none" checked> Don't contact me <br>

Produces the following output:

Please contact me by:
E-mail
Phone
U.S. Mail
Don't contact me

 

WebCentral Using Publishing Learning Training Consulting WebCentral
Answers Search Help
NIS  |  OIT  |  Boston University  |   January 9, 2007