Session Help
Posted: Mon Apr 14, 2008 2:05 pm
Hi guys,
I'm using two session variables $_SESSION[$sku] where $sku is retrieving something from a database
and $_SESSION[$price].
To display the contents of $_SESSION[$sku] i HAVE to use a foreach loop consisting of the following:
what i want to be displayed is a table that looks like this
HOWEVER, because of the foreach displaying each $_SESSION, it also echo's the $_SESSION[$price] which i dont want it to do and adds the following line to my table for an output of :
now i know its because of the foreach() loop i have going. I tried specifying only the $_SESSION[$sku] session in the foreach but it comes up with this error:
I'm using two session variables $_SESSION[$sku] where $sku is retrieving something from a database
and $_SESSION[$price].
To display the contents of $_SESSION[$sku] i HAVE to use a foreach loop consisting of the following:
Code: Select all
foreach($_SESSION as $key=>$value){
echo "<tr><td>$value</td><td>$key</td><td></td>";
echo "<td>$_SESSION[$price]</td><td></td>";
}Code: Select all
quantity sku price total
10 ipod_sock 12.00 120.00
Code: Select all
quantity sku price total
10 ipod_sock 12.00 120.00
12.00 12.00 12.00anyone know how I can go about doing this? I'm REALLY confused.Warning: Invalid argument supplied for foreach() in /home/users2/quinntk/public_html/morning/store/ShoppingCart.php on line 24