Hi I am trying to use a session array to create a very simple shopping cart using php with odbc, I think my code is fine so far but I have limited experience and so any help would be great.
my code so far is as follows
<?php
session_start();
$Conn = odbc_connect ('06', 'root', '');
$cprid = $_POST['sel_item'];
$cproduct = $_POST['sel_item_product'];
$cprice = $_POST['sel_item_price'];
$ctop = $_POST['sel_item_top'];
$cqty = $_POST['sel_item_qty'];
$_SESSION['cart'][] = array("productId" => $cprid,
"product" => $cproduct,
"price" => $cprice,
"ptopping" => $ctop,
"qty" => $cqty);
echo("<p>".$_SESSION['cart'][0]."</p>");
?>
however all this returns is the value array
Am I correct in assuming each time the values are posted to this page they will be adding into the array or am I missing something out. also how would I go about listing the items in the array? I am guessing that I am going be using a whie statement?
any help anyone can give me would be great.