O'Reilly logo

Sams Teach Yourself CGI in 24 Hours, Second Edition by Rafe Colburn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Session Management with Cookies

Now that you’ve seen how to create cookies and how to retrieve them after they’ve been stored, I can show you how to create and maintain sessions using cookies. You’re going to create what in all likelihood is the world’s smallest shopping site, because the catalog only contains two items. The way the site works is that there is a separate cookie for each unique item in the catalog. The cookie stores the quantity of the item that the user is going to order. When the user checks out of the store, the check-out program looks at the cookies that are sent back by the browser and builds a list of items that the user has ordered.

This isn’t how a real shopping site would work; if there were thousands of items in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required