Jay Eckles
Menu
Tutorials
  -CGI

 

Search

An Introduction to CGI - The Common Gateway Interface

by Jay Eckles

HTTP Cookies

HTTP is a stateless transaction model, which means that you can't save any information from one transaction to the next. If you have a CGI that implements a 3 step "wizard" registration process, you have to find some way to save the information from each step; you have to save the information to a temporary file and assign the process a unique temporary id that becomes a hidden field in subsequent forms - as you can see it can get messy. One way to maintain state between HTTP transactions has now become available: HTTP Cookies.

A Cookie is a piece of information stored on the client's machine at the server's request. Generally, cookies are stored in a file on the user's machine; this file is managed by the user's web browser or HTTP client application. Each cookie contains a domain (the domain for which the cookie is valid), the path on that domain on which the cookie is valid, the requested lifespan of the cookie (how long till the browser deletes it), and the value of a variable (the reason you set the cookie).

[Contents] [Next] [Previous]


If you have any questions or would like to contact me for any reason, please email me at j.eckles@computer.org.