Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Nov 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Add/Delete Items

    I have the following code, that displays a message whether a users shopping cart contains items or not.

    How do I add/delete items from the shopping cart, upon the appropriate product link being clicked? If a items is already in the cart, how do I display a message notifying the user?

    Code:
      $cart = $_SESSION['cart'];
      if (!$cart)
      {
        echo "You have no items in your shopping cart!";
      }
      else
      {
        echo "You have items in your shopping cart";
      }

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You really don't need to create multiple threads over this issue. I replied to this other thread with a suggestion on how to modify the way your cart is working to make deleting and adding items much easier.

    Couple of Questions


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •