Sessions in php

I always try to provide good information to beginners in php because these small looking problems may be big problem for a beginner. Session are one of them.
We use sessions when we get to a stage where our website need to pass along user data from one page to another.

A normal HTML website will not pass data from one page to another. In other words, all information is forgotten when a new page is loaded. This makes it quite a problem for tasks like a shopping cart, which requires data(the user’s selected product) to be remembered from one page to the next.

Using session you can send information between one page to another.However, this session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions. Sessions work by creating a unique identification(UID) number for each visitor and storing variables based on this ID. This helps to prevent two users’ data from getting confused with one another when visiting the same web page.

Read the rest of this entry »