TYPE = CHECKBOX

CHECKBOX creates a checkbox which can be either on or off:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">
<INPUT TYPE=CHECKBOX NAME="maillist">Yes! Put me on the list!<P>
<INPUT TYPE=SUBMIT VALUE="submit">
</FORM>
Yes! Put me on the list!

CHECKBOX is often used in groups to indicate a series of choices any one of which can be on or off:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">
<INPUT TYPE=CHECKBOX NAME="mushrooms"   >mushrooms<BR>
<INPUT TYPE=CHECKBOX NAME="greenpeppers">green peppers<BR>
<INPUT TYPE=CHECKBOX NAME="olives"      >olives<BR>
<INPUT TYPE=CHECKBOX NAME="onions"      >onions<P>
<INPUT TYPE=SUBMIT VALUE="submit">
</FORM>
mushrooms
green peppers
olives
onions

By default, the checkbox is initially off. If you want the checkbox initially on, use the CHECKED attribute. Checkbox CHECKBOXs are only sent to the CGI if they are on; if they are off, no name/value pair is sent (try out the form above to see).





About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.