Welcome Guest, Not a member yet? Register   Sign In
Help implementing checkboxes with submission to database.

I am trying figure out the best way to have form data be submitted to a database. Currently I have a table with a column for each form input. The only problem I have found is with check boxes since you can have multiple items being checked. There is just one field (column) for a section of check boxes.

So lets say there is an area for "choose your methods of contact" with 3 possible checkboxes: mail, phone call, snail mail. How would I go about entering this into the database without creating 3 separate fields in the database table which have an on and off state?

Any pointers would be appreciated, thanks!

You want to [url="http://us2.php.net/manual/en/function.serialize.php"]serialize()[/url] the array to create a delimited string. You can then unserialize() back out of DB into an array. That's even how CI stores session information in DB when enabled.

Theme © iAndrew 2016 - Forum software by © MyBB