Categories

PHP session variables

Managing session variables in PHP is really easy.
First thing to do is to initialise the variable. For instance

$_SESSION["myvariable"] = myvalue;

To use it, in another page, you can then just use $_SESSION["myvariable"].
Just remember to put at the top of the code this instruction:

session_start();

Actually, this will not re-initialise the session, but will create the session object with the current session variables.

Comments are closed.

Cyberactiva web development - Blogged