I\'m building a form using HTML with JQuery mobile so that the form can be used on mobile devices.
I have the form exporting to CSV via email. However the write to t
Change your HTML and give a name attribute to all your checkboxes, like so:
Once the form has been submitted, the name attributes will be passed as array and they'll be accessible using the same variable. Now, you can use isset() to check if a particular item was set:
if(isset($_POST['checkbox'])) {
print_r($_POST); //print all checked elements
}
If you want to get the number of checkboxes that were checked, you can use count():
$number = count($_POST['checkbox']);
Note: currently, only the first element has a value attribute. You'll have to add it for the rest of the checkboxes for it to work properly.
Hope this helps!