Basic HTML version of Foils prepared 11 May 1997

Foil 24 Content Fields of a Form: Radio Buttons and Checkboxes

From Introduction to HTML--ECS400 fall 97 ECS400 Senior Undergraduate Course -- Spring Semester 97. by Nancy J. McCracken *

A checkbox field has the form
Pepperoni <input type="checkbox" name="pepperoni">
If the user checks the box, then pepperoni=on is sent to the CGI program. Or you can add a value attribute such as value="ok", and then value=ok is sent.
Radio buttons are similar except that you typically put several of them with the same name field and the browser only allows one of them to be checked.
<input type="radio" name="topping" value="pepperoni"><br>
<input type="radio" name="topping" value="mushroom">
If the user checks mushroom, then topping=mushroom is sent to the CGI program.
Both fields allow an attribute checked, which makes the default value be on.
<input type="checkbox" name="pepperoni" checked>



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Aug 26 1997