KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Having trouble getting my POST arrays to show all checkbox values from my form. I have a form set up as follows: <form name='foo' method='post' action=''> <table> <tr> <td class='bla'>Checkbox: <input type='checkbox' name='cBox[]'/></td> </tr> <tr> <td class='bla'>Checkbox: <input type='checkbox' name='cBox[]'/></td> </tr> <tr> <td class='bla'>Checkbox: <input type='checkbox' name='cBox[]'/></td> </tr> </table> </form> I have a button at the bottom bound to a jquery function that adds 5 more empty rows to the form (hence the arrays for the input name cBox[]). Now, the problem. Lets say the first checkbox is unchecked, and the last 2 are checked. When I output the values (using PHP print_r for debugging), I will get: Array ( [0] => on [1] => on) For some reason, the array does not contain any value for unchecked checkboxes. I have seen some solutions where a hidden variable is passed with each checkbox, but can this solution be implemented in my situation (using arrays)?
Tags (comma-separated)
Save Edits
Cancel