1 | A checkbox field has the form |
2 | Pepperoni <input type="checkbox" name="pepperoni"> |
3 | 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. |
4 | 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. |
5 | <input type="radio" name="topping" value="pepperoni"><br> |
6 | <input type="radio" name="topping" value="mushroom"> |
7 | If the user checks mushroom, then topping=mushroom is sent to the CGI program. |
8 | Both fields allow an attribute checked, which makes the default value be on. |
9 | <input type="checkbox" name="pepperoni" checked> |