i have a simple shopping cart to be work and i come up to this problem
when i want to move from show_cart script to checkout_php script it gives me checkout form ampty with massege tall that there is no itmes in your crad
i have not set up ssl and i want to work with out it to see how to work
and this is my code:
Thanks so much!!!!
...
<?php
include ('book_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
@ $new = $GET['new'];
if($new)
{
//new item selected
if(!session_is_registered('cart'))
{
$SESSION['cart'] = array();
$SESSION['items'] = 0;
$SESSION['total_price'] ='0.00';
}
if(isset($SESSION['cart'][$new]))
$SESSION['cart'][$new]++;
else
$SESSION['cart'][$new] = 1;
$SESSION['total_price'] = calculate_price($SESSION['cart']);
$SESSION['items'] = calculate_items($SESSION['cart']);
}
if(isset($SESSION['save']))
{
foreach ($SESSION['cart'] as $modelnum => $qty)
{
if
($SESSION[$modelnum]=='0')
unset($SESSION['cart'][$modelnum]);
else
$SESSION['cart'][$modelnum] = $SESSION[$modelnum];
}
$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 '<p>There are no items in your cart</p>';
echo '<hr />';
}
$target = 'index.php';
// if we have just added an item to the cart, continue shopping in that category
if($new)
{
$details = get_book_details($new);
if($details['catid'])
$target = 'show_cat.php?catid='.$details['catid'];
}
display_button($target, 'continue-shopping', 'Continue Shopping');
// use this if SSL is set up
// $path = $HTTP_SERVER_VARS['PHP_SELF'];
// $server = $HTTP_SERVER_VARS['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();
?>
and here is the checkout.php script
<?php
//include our function set
include ('book_sc_fns.php');
// The shopping cart needs sessions, so start one
session_start();
do_html_header('Checkout');
if($SESSION['cart']&&array_count_values($SESSION['cart']))
{
display_checkout_form();
display_cart($_SESSION['cart'], true, 1);
}
else
echo '<p>There are no items in your cart</p>';
display_button('show_cart.php', 'continue-shopping', 'Continue Shopping');
do_html_footer();
?>
i need your help to learn what is wrong with my shopping card