coming from a page that shows book details, A user clicks "add to cart" and the following url (CHAPTER25d/show_cart.php?new=0672317842) leads to the next page with the following information
<?
include ('book_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
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);
}
so how is cart registered and why is it incrmented by one? And what about the parameter passed to "new" in the url?
I need a good explanation of what's happening here, otherwie I am operating without unerstanding exactly what I am doing.
Thanks