I have the following checkbox created by a loop:
<input type='checkbox' value=0 name='<?php echo $question_id; ?>' />
Each checkbox will have a different ID, and when the user checks several checkboxes, I would like to gather all the id's and insert it into a table that relates an 'event' table with a 'questions' table.
However I am not getting the ids...I know I am supposed to use an array, but is that in the name attribute or the values attribute? Also, how do I pass on the IDs...does that go into the values field?
Your html:
Your PHP:
I believe you need something like ..
You'll loop through the
field_name
which happens to be an array.Try changing your input to this.
Now when you get the post with php it will return an array with all the question ids
In HTML:
In PHP:
Or, alternatively:
In HTML:
In PHP: