1<div>
2 <input type="checkbox" id="scales" name="scales"
3 checked>
4 <label for="scales">Scales</label>
5</div>
6
7<div>
8 <input type="checkbox" id="horns" name="horns">
9 <label for="horns">Horns</label>
10</div>
1<!--
2 You can also group multiple checkboxes by giving them the same "name".
3 When posted to PHP, all the checked boxes' values will appear in the
4 $_POST array under an index with the same name as your checkboxes.
5
6 E.g. if we check "bananas" and "apples" below and post the form then
7 our $_POST array will look something like this:
8 ['fruit' => ['bananas', 'apples']]
9-->
10<form>
11 <label>
12 <span>Bananas</span>
13 <input type="checkbox" name="fruit[]" value="bananas">
14 </label>
15
16 <label>
17 <span>Apples</span>
18 <input type="checkbox" name="fruit[]" value="apples">
19 </label>
20
21 <label>
22 <span>Grapes</span>
23 <input type="checkbox" name="fruit[]" value="grapes">
24 </label>
25
26 <button type="submit">Submit</button>
27</form>
1<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
2<label for="vehicle1"> I have a bike</label><br>
1<!doctype html>
2<html>
3 <body>
4
5 <input type="checkbox">
6 <input type="radio">
7
8 </body>
9</html>
1<input type="checkbox" name="vehicle1" value="Bike">
2
3The checkbox value is 'Bike'.