Adding Check Boxes and Radio Buttons
Check boxes are an excellent way to get information from a site visitor from a preset selection of choices. The advantage of check boxes is that visitors can select from more than one option, and that's the best time to use them—when the possibility of multiple answers exists. To create check boxes, you use the input element along with the type attribute and a value of checkbox (see Example 5-5).
Example 5-5. Adding check boxes to the form
<p>Please choose your favorite way(s) to relax:</p><input type="checkbox" name="reading" id="reading" />Reading<br /><input type="checkbox" name="sports" id="sports" />Sports<br /><input type="checkbox" name="games" id="games" />Computer Games<br /><input type="checkbox" name="tv" id="tv" />Television<br /> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access