JavaScript is not enabled in your browser. These examples will not work without JavaScript.

Forms: Checkboxes

In this form, we have a set of checkboxes and a set of radio buttons. Note that with checkboxes, you can select all that apply. With radio buttons, only one item can be selected. This default behavior should not be changed; you should always use the correct type of form element for the task.

Notice how in a set (whether it's checkboxes or radio buttons), all items in that set must have the same name (in the HTML). This is important for making the form work correctly, particularly when form input is written out to a database. The id, on the other hand, must be unique for each item, not only in a set, but on the entire page.

If you're sending the form data out to a database (on a Web server), test it carefully to make sure all checkbox data is being saved correctly.

Note that the Reset button resets all form elements, but it does not reload the page.

What do you want on your pizza?








How much pizza do you want?



Return to the index.