Is it alright if I put the cat[] array value in the for, name and id attributes.
code.
<label for="cat[]">' . $cat['category'] . '</label>
<input type="checkbox" name="cat[]" id="cat[]" value="' . $cat['id'] . '" />
Short Answer: No.
No because:
cat[]. However, the id attribute must be unique. Therefore, you can't have the id and name equal. If you don't have a decent unique id for each checkbox then just increment cat. So the first checkbox would have an id of cat1, the second an id of cat2 and so on.From w3C
character "[" is not allowed in the value of attribute "for"
character "[" is not allowed in the value of attribute "id"
Try it out validator