How to submit value 1 if a checkbox in a checkbox array is checked, and submit 0 if it\'s unchecked? I tried this but no luck. I am trying to grab this array in a php array
Simplest one, no javascript required, just put a hidden input before the checkbox:
Inputs need to have the same name. If the checkbox is checked then value 1 will be submitted, otherwise value 0 from the hidden input.
Your case javascript solution, no hidden inputs needed:
PHP solution, no hidden inputs needed:
EDIT: the javascript solution is not valid anymore as of jquery 1.6. Based on this, a more proper solution is the following: