$qty) {if ($_post[$isbn] = = ' 0 ') {unset ($_session[' cart '] [$ISBN]); } else {$_session[' cart '] [$ISBN] = $_post[$ISBN]; }} $_session[' Total_price ' = calculate_price ($_session[' cart '); $_session[' items '] = Calculate_items ($_session[' cart '); } do_html_header ("Your shopping cart"); if (($_session[' cart ') && (array_count_values ($_session[' cart '))) {Display_cart ($_session[' cart ')); } else {echo 'There is no items in your cart
"; } $target = "index.php"; If we have just added a item to the CART, continue shopping in that category if ($new) {$details = Get_book_det Ails ($new); if ($details [' catid ']) {$target = "show_cat.php?catid=". $details [' catid ']; }} Display_button ($target, "continue-shopping", "continue shopping"); Use the If SSL is set up//$path = $_server[' php_self '); $server = $_server[' server_name '); $path = Str_replace (' show_cart.php ', ' ', $path); Display_button ("https://". $server. $path. " Checkout.php ",//" Go-to-checkout "," Go to Checkout "); If no SSL use below code Display_button ("checkout.php", "Go-to-checkout", "Go to Checkout"); Do_html_footer ();? >
What does the $_session[' cart ' [$new] in the code mean, and why do you do it this way?
Reply to discussion (solution)
You'll know if you print your $_session.
An array object called a cart is stored in the $_session, and the $_session[' cart ' is removed $new is the key value of the array, the $_session[' cart ' [$new]