Okay. Y'wanna get multiple checkbox checks into an sql table?
First, all your checkboxes must be of the form
<input type='checkbox' name='name[]' value='value' />
This means that the result of the check box posting goes into an array variable called 'name'. You can define a key for your checkbox posts :
<input type='checkbox' name='name[1]' value='value1' />
So in your posted data, the array element with a key of 1 would have a value of value1. You don't have to define keys, though. If you've got distinct keys, use distinct variables, not an array for everything.
Now. You've submitted your form. Your processing script should have a part which looks something like this:
/check to see if an array name[] has been submitted. if it has, then one or more checkboxes were checked. /
if (is_array($_POST['name'])) {
//an array to temporarily hold our checkbox data
$var = array();
/for each element of the posted array (each checkbox), add it to the $var array. Note you could also define $var with the posted keys, if you're using them, i.e. $var[$k] = $v; /
foreach ($_POST['name'] as $k => $v) {
$var[] = $v;
}
/cast $var to a string, and give it a value of the elements it previously held, joined by the '' character /
$var = @implode("", $var);
}
At the end of that, your $var string should hold something like this:
"value1_value2_value3" etc.
You can insert this into a varchar field in your database, then explode it with the '_' character to get the seperate values.
Test this by doing exit($var) or print $var or something, to make sure the data's getting into the form you want it.
That code works, I tested it m'self :p
Cheers,
Alex ...
PS - Here's the code without the comments:
if (is_array($_POST['name'])) {
$var = array();
foreach ($_POST['name'] as $k => $v)
{
$var[] = $v;
}
$var = @implode("_", $var);
}