Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. function writeShoppingCart() {
  2. $cart = $_SESSION['cart'];
  3. if (!$cart) {
  4. return '<p>You have no items in your shopping cart</p>';
  5. } else {
  6. // Parse the cart session variable
  7. $items = explode(',',$cart);
  8. $s = (count($items) > 1) ? 's':'';
  9. return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>';
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement