I have a list of items with checkboxes. When I go to another page I store checkboxes into a cookie and then store them in a session on the new page. If I check more boxed on another page I need to add the new values to the existing session which contains array of all values.
I think I've overcomplicated this already and can't seem to be able to get it right. Here's what I got:
if (isset($_GET['page'])) {
$MIDarrayValues .= ','.$_SESSION['mID'];
$MIDarrayValues = trim($MIDarrayValues, ',');
$midArray = array();
$midArray = $MIDarrayValues;
$_SESSION['mID'] = array_unique($midArray);
} else {
$_SESSION['mID'] = $_COOKIE["mID"];
}
echo $_SESSION['mID'];