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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access