I'm new to cookies here is how i'm setting and retrieving data
if(!isset($_COOKIE['cart'])){
$_COOKIE['cart'] = array();
}
setcookie("cart[$stk_id]['name']", $name, time()+24*60*60, "/");
setcookie("cart[$stk_id]['quantity']", $qty, time()+24*60*60, "/");
setcookie("cart[$stk_id]['vendor']", $vendor, time()+24*60*60, "/");
foreach ($_COOKIE['cart'] as $stk_id => $product){
$qty = $product['quantity'];
$pro_name = $product['name'];
}
but i'm getting error Notice: Undefined index: quantity and name. what is the problem?