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'] . '" />
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'] . '" />
No, just name (passed to server side), ID must be unique with no special characters and cannot start with a number.
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.