Once you have put your data safely away, it becomes immediately available in the $_SESSION superglobal array with the key of the variable name you gave it. Here is an example of setting data and reading it back out again:
$_SESSION['foo'] = 'bar';
print $_SESSION['foo']; ?>
Unlike cookies, session data is available as soon as it is set, which can be quite an advantage.
Next chapter: Removing session data >>
Previous chapter: Adding session data
Jump to: Cookies and Sessions Cookies vs. Sessions Cookies Sessions Choosing the appropriate option Using cookies Using sessions Starting a session Adding session data Reading session data Removing session data Ending a session Checking session data Files vs. Databases Storing complex data types Summary Exercises Further reading Next chapter
Home: Table of Contents
Follow us on Identi.ca or Twitter
© Future Publishing Limited, Beauford Court, 30 Monmouth Street, Bath BA1 2BW. All rights reserved. England and Wales company registration number 2008885.