I am having problem with updating an array element with in $_SESSION variable of PHP. This is the basic structure:
$product = array();
$product[
this not best answers for u...but hope can help u guys im not expert coders, and just learn coding in this forum ^,^ .You must always trying to solved. for more example hope can help to update value quantity:
$id,
'nm_produk' => 'hoodie',
'img_produk' => 'images/produk/hodie.jpg',
'harga_produk' => '20',
'qty' => '2'
);
//if not empty
if(!empty($_SESSION['cart']))
{
//and if session cart same
if(isset($_SESSION['cart'][$id]) == $id) {
$_SESSION['cart'][$id]['qty']++;
} else {
//if not same put new storing
$_SESSION['cart'][$id] = $newitem;
}
} else {
$_SESSION['cart'] = array();
$_SESSION['cart'][$id] = $newitem;
}
}
?>