title: Using session and cookies for persistent data
body: <p>I'm about to tackle a 'shopping cart' of sorts in PHP, but as I'm still new to all this, I wanted to find out the best approach from people that know better.</p>
  
  <p>I want items that are added to the basket to be available for several days, should the user not log in or checkout.  I've been using zavvi.com as an example so I can try to replicate how they do it.</p>
  
  <p>I know that session data is only available whilst the browser is open, and is deleted from the server's memory when the browser is closed.  I also understand that cookies are saved to the client for more persistent data, with a defined expiry.</p>
  
  <p>However, using Zavvi as an example, I can't understand how the cookie does its thing. There is a cookie called 'ElysiumBasketzavvi_V6' that presumably stores the contents of the basket. But the content (e.g. MjI1MzM3NjI4) of the cookie looks like some sort of encryption?</p>
  
  <p>I'd be very grateful if someone could give me a few points regarding the order of events, when to use the session ID and how to store and retrieve basket contents so that it works like Zavvi, which I'm assuming is how it should be done.</p>