Hi all
I have a series of forms, some of which have checkboxes in them. I am using sessions to carry variable values through the form process.
My problem is when someone goes back to a previous form to update a checkbox value, the new value is being posted and added to the session but the old session value (now an unchecked checkbox) is not being updated and the old session value still exists.
eg.
1) First time submitted
checkbox 1 = checked
checkbox 2 = not checked
when submitted
$_SESSION[checkbox1] = checkbox1
2) When returning to update form
checkbox 1 = not checked
checkbox 2 = checked
when submitted
$SESSION[checkbox1] = checkbox1
$SESSION[checkbox2] = checkbox2
As you can see above, the $_SESSION[checkbox1] variable still exists.
Can anyone suggest how I can either remove the $_SESSION[checkbox1] variable or update it with a 'null' value....????
Note: Session variables are being created using:
foreach ($_POST as $key=>$value) {
$_SESSION[$key] = $value;
}