Greetings! I have a form that submits to $PHP_SELF. I have a checkbox called "role_id" -- the user can select any number of role_ids.
How do I do an INSERT into the database where I would insert per row the user_id and role_id for every value selected from the checkbox? Meaning, how do I gather the values of the checkboxes and then build the INSERT query?
Thanks much!
collect all of the checkboxes into an array:
<input type="checkbox" name="role_ids[]" value="1"> (repeat for all "roles", 2,3,4, etc...)
then on your form processing page iterate threu the array to build your INSERT query.