Page 1 of 1

Entering multiple checkbox values to database

Posted: Tue Nov 17, 2009 6:28 am
by arny2009
Hi All,

I need to submit 3 different set of check box values into the database. I have created the 3 sets of checkboxes with 3 different names each set has a particular name e.g. can[],looking[],activities[].
Now I need to use the array values collected from form post.

I need code to help me out on this.

Thanks in advance !!!

Re: Entering multiple checkbox values to database

Posted: Tue Nov 17, 2009 6:42 am
by iankent
I might be missing something, but wouldn't this work?

Code: Select all

$arr = $_POST["looking"];
foreach($arr as $val) {
    // code to insert to db here?
}
alternatively, depending on how your db is setup, you could implode the array to store the values as a single string?