I am working on a shopping cart site and am experiencing intermittent problems with the shopping cart not adding items -sometimes you can add items, other times it just replaces the previous item with the new.
The error message I get is below:
Warning: Cannot send session cookie - headers already sent by (output started at /usr/home/b/e/beats/public_html/show_cart.php:2) in /usr/home/b/e/beats/public_html/show_cart.php on line 5
Warning: Cannot send session cache limiter - headers already sent (output started at /usr/home/b/e/beats/public_html/show_cart.php:2) in /usr/home/b/e/beats/public_html/show_cart.php on line 5
The relevant section of code it refers to is below:
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);
}
Any ideas as to what may be the problem?Any help/pointers much appreciated.
regards,
Robin Porter