Sessions
Posted on April 14th, 2008 in Classes | No Comments »
PHP Sessions – Why Use Them?
A session is a way to store information (in the form of variables) to be used across multiple pages. Unlike a cookie, specific variable information is not stored on the users computer. It is also unlike other variables in the sense that we are not passing them individually to each new page, but instead retrieving them from the session we open at beginning of each page.
Start a PHP Session
Before you can begin storing user information in your PHP session, you must first start the session. When you start a session, it must be at the very beginning of your code, before any HTML or text is sent.
Below is a simple script that you should place at the beginning of your PHP code to start up a PHP session.
<br /> session_start(); // start up your PHP session!<br />
This tiny piece of code will register the user’s session with the server, allow you to start saving user information and assign a UID (unique identification number) for that user’s session.
Read the rest of this entry »



