Point your browser to
But here's the basics.
At the beginning of any script where you might need session variables, invoke the function session_start(). That will start the session handling system.
Tell PHP what variable or variables it should track. session_register ("last_http_referer"

, for example. You only have to issue this command once anywhere in your site. From then on, any time you issue session_start() at the beginning of a script, the variable will be available.
From the issuance of sessaion_register ("last_http_referer"

, you can access the contents of that variable either through $_SESSION["last_http_referer"

or $HTTP_SESSION_VARS["last_http_referer"]. [NOTE: Both variables are available if you are using PHP version 4.1.0 or newer. Otherwise, only $HTTP_SESSION_VARS is available.]
In any script, the current referer is in either $_SERVER["HTTP_REFERER"] or $HTTP_SERVER_VARS["HTTP_REFERER"]. [Again, $_SERVER is available only in PHP version 4.1.0 or newer] ______________________________________________________________________
Perfection in engineering does not happen when there is nothing more to add.
Rather it happens when there is nothing more to take away.