Hello!
So I've created a form wich, by the post function, send me several values.
$_POST[groups]
sends me, using 4 different checkboxes values 1, 2, 4 and 8.
$_POST[retailgroup]
does the same, but only the values 1, 2 and 4.
The problem is that I want these to add up together and then send the sum of the values to a MySQL table.
I've managed to do one using the following foreach loop:
foreach ( $_POST as $val ) {
foreach ( $val as $key=>$final_val ) {
$group = $group+$final_val;
}
}
The problem starts when I need to have these two apart from each other since they are going into separate columns in the table.
To be clear I've assigned different groups different values (always taking the prev value times two, just like counting binary) like 1, 2, 4 and 8. By adding them together I can determine membership in the groups by doing a subtraction "backwards". Since there are different kinds of groups I want them into two separate fields of the table.
I hope everything is clear.
Any idea on how to do this?