I want to use $_SESSION
to store items in cart. The items are defined by id
, each item has 3 sizes and for each size there will be stored item's quantity. I would like to use multidimensional associative array like that
$_SESSION['cart']['id'.$_GET['id']]['size'.$_POST['size']]['quantity'] += $_POST['quantity'];
but I guess the problem which I am getting (Notice: Undefined index
) is because the arrays are not defined first.
I would like to keep it simple, so what would be the easiest way?