It’s time to learn about sessions in PHP.
Here is some basic code to start a session, and display the resulting $_SESSION superglobal:
<?php session_start(); echo '<pre>'; var_dump($_SESSION); echo '</pre>';
The resulting output:
array(0) { }
To prove that it’s working, simply comment out the session_start() call:
<?php //session_start(); echo '<pre>'; var_dump($_SESSION); echo '</pre>';
Which results in:
NULL
So now I know how to turn sessions on. Next, I need to understand a little more about how sessions work.
PHP Sessions: Part 1