i'm trying to build a shopping cart.
i have a form that submits to $PHP_SELF
the idea is to send the product id from the form into an array that is registered as a session.
<form method=post action=$PHP_SELF>
<input type=hidden name=cart value=add>
<input type=text name=product value=1001>
<input type=submit>
</form>
that is the form .. here is the section of code that i want to add the product variable into the array called $cart_array.
if($cart == "add"){
if(is_array($cart_array)){
array_push($cart_array,"$product");
} else {
$cart_array=array("$product");
}
session_start();
session_register(cart_array);
it will put the first product in, but the array never builds past 1 item.
any ideas?