Hi,
I've spent most of today trying to solve this problem, but sadly no
luck.
I have an shopping basket based on an array which stores the name,
product id, quantity and price for products, i want to take the
Information in the array and output the Quantity and Product ID
information into variables so that i can pass them into a Select
Statement and submit the order to the database.
The Current Code to Show the cart is listed below: -
function show_cart() {
if (isset($_SESSION["item_count"]) && $_SESSION["item_count"] > 0) {
echo "<table class=\"basket\"border=\"0\">";
echo
"<tr><td>Item</td><td>Price</td><td>Amount</td><td>Subtotal</td></td></tr>";
$total = 0;
for($i=0; $i<$_SESSION["item_count"]; $i++) {
echo "<td><a
href=insertselfpagehere.php?deleteitem=1&ProdID=". $_SESSION["items"][$i][0].">";
$item=$_SESSION["items"][$i][0];
echo $_SESSION["items"][$i][1]."</a></td>";
echo "<td>".$_SESSION["items"][$i][2]."</td>";
echo "<td>*".$_SESSION["items"][$i][3]."</td>";
$subtotal = $_SESSION["items"][$i][2] * $_SESSION["items"][$i][3];
echo "<td align=\"right\">$subtotal</td>";
echo "</tr>";
$total += $subtotal;
}
echo "<tr><td><b>total</b></td><td align=\"right\"
colspan=\"3\">$total</td></tr></table>";
}
else {
echo "No items";
}
}
Any help would be much appreciated, i seem to have a mental block with
PHP at the moment.
Kind Regards,
Ian