justravis Posted September 5, 2008 Share Posted September 5, 2008 Do people still use checkbox arrays? Validators seem to pick on them. Plus, how do you attach a label to 1 checkbox, when they are all named the same? Thanks! Link to comment https://forums.phpfreaks.com/topic/122828-solved-label-tags-for-checkbox-arrays/ Share on other sites More sharing options...
lemmin Posted September 5, 2008 Share Posted September 5, 2008 I use checkbox arrays all the time. Give the checkbox an ID and use that with the for property of the label object: <input type="checkbox" name="chks[]" id="chk1"><label for="chk1">checkbox1</label> <input type="checkbox" name="chks[]" id="chk2"><label for="chk2">checkbox2</label> Link to comment https://forums.phpfreaks.com/topic/122828-solved-label-tags-for-checkbox-arrays/#findComment-634655 Share on other sites More sharing options...
haku Posted September 6, 2008 Share Posted September 6, 2008 As lemmin was saying, the 'for' attribute refers to the ID in the tag. Link to comment https://forums.phpfreaks.com/topic/122828-solved-label-tags-for-checkbox-arrays/#findComment-635014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.