View Full Version : Multiple Selections with checkboxes

11-25-2007, 06:24 AM
I need to have a series of options that can be selected with checkboxes. I suspect that in the future I'm going to need to add/delete/modify the number of these checkboxes.

Can you suggest a better method of handling this than adding a field in my DB to match each checkbox on the form? I mean, if I have to change the number of check boxes down the road, I will have to recode the form and add/delete fields from the DB structure. Is there a method for retrieving an array of the checkbox results for example?


11-25-2007, 07:48 AM
you can make one field called checkboxes (or whatever) and fill it with


Then in the php if you save the field in the $str var:

$checkboxes = explode('|', $str);
echo($checkboxes[0]); // 'one'
echo($checkboxes[3]); // 'four'

Then when you get a new checkbox you can add it on the end of that.