I am using a form to create several arrays in a Session. Each time the form is submitted a new _SESSION[‘item’][] is made containing a new array. The code for this:
$newitem = array (
'id' => $row_getshoppingcart['id'] ,
'icon' => $row_getimages['icon'],
'title' => $row_getimages['title'],
'medium' => $row_getshoppingcart['medium'],
'size' => $row_getshoppingcart['size'],
'price' => $row_getshoppingcart['price'],
'shipping' => $row_getshoppingcart['shipping']);
$_SESSION['item'][] = $newitem;
There could be any number of item arrays based on how many times the user submits the form. How can I get the total of the key ‘price’ from every item in the entire session and echo it on the page?
Thank you in advance for your time. I really appreciate it.
Try this (untested):