https://dev.webpages.dk/  
 
PHP How to Use SESSION
PHP How to Use SESSION

Session variables can be seen as a kind of 'global' variables. This means that you can bring some variable values from one page to the next.
You just have to be aware that you have to piut this short string in the absolute top of each page where you use the session variable, else it simply not work.

<?php session_start(); ?>

 $_SESSION['variable_name_here']

How do you Use SESSION variables in PHP?

The short text that you see in the footer (Statusbar) of these pages are made using a variable.
The variable is called a $_SESSION['variable_name_here'];
The things about this is that it can help you carry values from one page to another in your project.
You have to insert a special tag in the top of the pages if you are to use this though. That tag looks like so;
<?php session_start(); ?>
Remember that it have to be the very first content on the page where you want to use SESSION variables.
Let's say that you have a user login on one page, and want to carrry the users name onto another page, where you are to use that, then do something like this;

$_SESSION['usersname'] = $_POST['usersname'];
Then you can recall that value on another page, if you were to use the users name there.
echo $_SESSION['usersname'];

Icons made by Freepik from www.flaticon.com Here you see how you use the SESSION variable. Carry a variabel value from one page to another.
13:58:15