Web Analytics Made Easy -
StatCounter Shopping cart - CGI cookies - CodingForum


No announcement yet.

Shopping cart - CGI cookies

  • Filter
  • Time
  • Show
Clear All
new posts

  • Shopping cart - CGI cookies

    Hi everyone,

    I've been doing some reading up about how to make a shopping cart for one of my assignment.

    It's going along quite well as i have managed to pick of CGI/PERL, MySQL and HTML. However i have some questions about cookies to store cart information. I've been reading some tuts on the net and they all talk about how to create cookies and send them through the header. But I want to know is how they actually store information? say i want to store the the products and quantity of products that have been added to a shopping cart. Where does the information get stored and how do you update it?

    I was thinking simply having a database called shoppingCart which manages the number of products etc etc. instead of using cookies..

    I hope i havnt confused you guys,

    Thanks again for the help,

  • #2
    Cookies are stored on the visitor's PC (hard drive). You are limited to the
    amound of cookies and how big they are. You can specify if the cookie should
    die when the visitor closes their browser, or after a specific date, or never die.

    Because cookies are stored on the visitor's PC, that person can exit your site
    and come back, with the shopping cart contents retained. Because the
    cookies are stored on their PC, don't store any sensitive data, as there is
    no security.

    So, that's where MySQL comes into play. A visitor registers with your
    shopping cart and therefore, gets their own file on MySQL, which is stored
    on your webhost's server. All of their shopping cart items, personal data,
    is stored there. Cookies are only used to indicate whether or not the
    visitor has correctly "logged-in". You still won't transfer any credit card
    information unless you have a Secure Server account, but that's beyond
    what your assignment is (I assume).

    So, you'll need to decide which method to retain your shopping cart items.