HTML Form: Multiple selections using checkboxes

This entry is part 8 of 10 in the series HTML Form

Check boxes allow users to make multiple independent selections.

In the example below, we post a question to the users and as an example, we have England always checked.

This is done by using checked=’checked’.

The name=’country’ is the name for this set of checboxes.  If this form has a script, the value field will be used to identify the checkboxes that were selected.

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Form</title>

</head>
<body>

<p>Which countries would you like to visit?</p>

<form method='post'>
    <input type='checkbox' name='country' value='england' checked='checked'>England<br>
    <input type='checkbox' name='country' value='brazil'>Brazil<br>
    <input type='checkbox' name='country' value='malaysia'>Malaysia<br>

</form>

</body>
</html>

 

Series Navigation<< HTML Form: Form that is sent through Email
HTML Form: Radio buttons >>