Insert dynamic checkbox values into multiple mysql fields using php
Posted on 2008-06-17
I need to insert dynamically populated checkbox values into multiple fields of a mysql database using php. I think I need a "for each" statement, but can't seem to get it right.
Here's the php (while statement) that sets up the checkboxes - this works:
// Show records by while loop.
<input name="nominee" type="checkbox" id="nominee" value="<?php echo $rows['n_uuid']; ?>"> <?php echo $rows['n_first']; ?> <?php echo $rows['n_last']; ?> - <?php echo $rows['n_uuid']; ?><br />
// End while loop.
Now - I'm stuck on my insert...
As I said - I need to insert all checked values into one row, separate fields in the database
This is for an election voting process for the staff senate. There are 8 clusters A,B,C,D, etc. involved with a total of about 300 voters.
The voters login and are authenticated through LDAP - then through a table with all voters names. If they aren't in that table - they can't vote.
Once authenticated, they are presented with this dynamically populated checkbox list with nominees from their cluster. Each cluster has a different amount of seats open for nomination so the checked boxes will be different amounts each time.
If I can just get them into separate fields of the database, I'll be happy.
Thanks for your help.