Coming from a page that shows a book and allows you to add that book to your cart we have a button that passes an $isbn
display_button("show_cart.php?new=$isbn", "add-to-cart", "Add ".$book["title"]." To My Shopping Cart");
When this button is pressed it automatically brings the viewer to show_cart.php where the contants of the cart are displayed
the beginning code of "show_cart.php" checks if the session_$cart is registered.
I don't understand where the session cart ever gets registered
Show_cart.php code follows
if($new)
{
//new item selected
if(!session_is_registered("cart"))
{
$cart = array();
session_register("cart");
$items = 0;
session_register("items");
$total_price = "0.00";
session_register("total_price");
}
if($cart[$new])
$cart[$new]++;
else
$cart[$new] = 1;
$total_price = calculate_price($cart);
$items = calculate_items($cart);
}
I can see how the $cart is registered if the viewer presses "view cart" before adding anything to the cart but how is the $cart session registered from "show_book.php" when the viewer presses "add to cart".
There must be a simple explanation.
Been spending plenty of time with in the newbies section so I decided to let the pros answer this one.
Thanks.