in reply to Re^4: Question regarding CGI and cookies
in thread Question regarding CGI and cookies

If there is no cookie, there are no previous purchases. Adding the new purchases to nothing yields a combined purchase that consists only of the new purchase. That gets saved. If the user keeps adding more purchases without closing the browser, the next thing they purchase will get added to that original purchase because there is now something in the cookie (the first purchase). If, however, they close the browser and then re-open it and come back and make a second purchase, the cookie will have expired and their first purchase forgotten. That's the desired behaviour - remember the shopping basket for the current browser session and forget it when the current browser session closes. That way the cookie keeps a running total of all purchases in the current session but does not keep anything between sessions.
  • Comment on Re^5: Question regarding CGI and cookies