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

The Catalog

First let’s take a look at the catalog script. It serves two purposes—it lists the products on the screen, and it adds selected products to the shopping cart. Each item in the cart has its own form, which the user can submit to add an item to the cart. The form fields are passed back to the catalog.pl script through the query string.

Like many of the scripts presented in this book, it decides what to do based on the parameters it receives in the query string. If a product ID is passed to the script, it retrieves the user’s session ID or assigns a new one, and attempts to add that product to her cart. If no product ID is passed to the script, it just displays the product listing without altering the contents of the user’s cart. 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