Fact: HTML is stateless. Terrific....but what does that mean? Basically, HTML has a what "happens here, stays here" attitude about things. Once served up by the web server to your browser, it's what you see is what you get. Look at the source code for an HTML page. That's all there is.
The exception is forms. Forms are used to collect input from a visitor and pass that input along to the form action. The action, in most cases is another HTML page or a script sitting in a cgi-bin on the web server.
But, once the form does its job, the information goes away and you can't use it again without retrieving it from wherever you sent it to. A database, file or whatever. Now, most of the time that's just fine. You've done all you planned on doing with the info.
But, what if you need to use that info to do something like personalize your site for a visitor.
This case study will show you how to do that. How? By using PHP sessions. Sessions can also be used for more complex tasks like shopping carts or membership systems.
What's a Session?
Let's define it as "what happens with certain information when you visit a web site that uses PHP sessions as you move through the site. Either until you leave the site and close your browser or the PHP code in the site ends the session based on something you do/don't do on the site."
Starting a Session
The code is simple: