i have a session array called $_SESSION['CART'] i already use it to store details of cart items now i want to store multiple uploaded files names of files that user uploads while adding this item to cart as part of the session cart.i want to store them with key files. this is what am doing but its not working. is there a way for me to achieve this
$_SESSION['cart'][] =
array(
'id'=>$productid,
'quantity'=>$quantity,
'detail'=>$detail,
'files'=>$files
);
Nothing much to explain here. if you want to store multiple array inside of array to store multiple file names. I assume that $files is a single file name only. Try this.
$_SESSION['cart'] = array(
array(
'id'=>$productid,
'quantity'=>$quantity,
'detail'=>$detail,
'files'=>$files
)
);
You can't use $_SESSION array like this way, try to use buffer variable to prepare data for session:
$cart = $_SESSION['cart'];
$cart[] = array(
'id' => $productid,
'quantity' => $quantity,
'detail' => $detail,
'files' => $files
);
$_SESSION['cart'] = $cart;