August 2013
Intermediate to advanced
140 pages
1h 49m
English
CHAPTER 25
![]()
Sessions
A session provides a way to make variables accessible across multiple web pages. Unlike cookies, session data is stored on the server.
Starting a session
To begin a session the session_start function is used. This function must appear before any output is send to the web page.
<?php session_start(); ?>
The session_start function will set a cookie on the client’s computer containing an id used to associate the client with the session. If the client already has an ongoing session the function will resume that session instead of starting a new one.
Session array
With the session started the $_SESSION array can be used to store ...
Read now
Unlock full access