Code: Select all
function writeShoppingCart() {
$cartid = $_SESSION['cartid'];
if (!$cartid) {
return '<p>You have no items in your shopping cart.</p>';
} else {
// Parse the cart session variable
$items = explode(',',$cartid);
$s = (count($items) > 1) ? 's':'';
return '<p>You have <a href="viewCart.php">'.count($items).' item'.$s.' in your shopping cart.</a></p>';
}
}