PHP and MySQL Web Development - P90: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Implementing Simple Sessions 417 _SESSION myvar 5 or HTTP_SESSION_VARS myvar 5 If you are using an older version of PHP or if you have register_globals turned on in order for a variable to be tracked from one script to another you can to register it with a call to session_register . For example to register the variable myvar you could use the following code myvar 5 session_register myvar Note that you need to pass a string containing the name of the variable to session_register .This string should not include the symbol. This will record the variable name and track its value. The variable will be tracked until the session ends or until you manually deregister it. You can register more than one variable at once by providing a comma-separated list of variable names for example session_register myvar1 myvar2 If you are using the _SESSION or HTTP_SESSION_VARS arrays do not try and use the session_register function. Using Session Variables To bring a session variable into scope so that it can be used you must first start a session. You can then access the variable via the arrays _SESSION or HTTP_SESSION_VARS as for example HTTP_SESSION_VARS myvar . If you have register_globals turned on you can access it via its short form name for example myvar. If you have register_globals on bear in mind that a session variable cannot be overridden by GET or POST data which is a good security feature but something to bear in mind when coding. On the other hand you need to be careful when checking if session variables have been set via say isset or empty . Remember that variables can be set by the user via GET or can check a variable to see if it is a registered session variable by calling the session_is_registered call this function like this result session_is_registered myvar This will check whether myvar is a registered session variable and return true or false. If using _SESSION or HTTP_POST_VARS you should NOT use the session_is_reg-istered can