Reputation:
hi i want to name each checkbox field and display when selected any one of them. i have problem naming them. is this the right code ?
<div class="form-group">
<div class="checkbox">
<label>
<p><b> Services Interested </b></p>
<input type="checkbox" name="service"> Wordpress </br>
<input type="checkbox" name="service"> SEO </br>
<input type="checkbox" name="service"> PHP
</label>
</div>
</div>
Upvotes: 0
Views: 49
Reputation: 1548
You can use the below name for all the checkboxes:
name="service[]"
Upvotes: 0
Reputation: 3636
You cannot give them all the same name; the browser would not be able to tell the difference between them. You'll have to give each one a unique name. Only Radiobuttons have the same name, because only one can ever be set. (It uses the matching name to determine which ones to disable when you click another with the same name)
Every other input element requires a unique name for each.
Upvotes: 1