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> |