Session is a way to store information across multiple pages in a website. How to start a session: A session can be started by using session_start() function.We can set session variable by using PHP global variable $_SESSION. consider an example: create a new page demo1.php and start a new PHP session in this page and set some session variables. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <?php // Start the session session_start (); ?> <!DOCTYPE html> <html> <body> <?php // Set session variables $_SESSION [ "username" ] = "sowmya" ; $_SESSION [ "email" ] = "sowmya.vejerla@gmail.com" ; echo 'username : ' . $_SESSION [ 'username' ]; echo '<br>' ; echo 'email : ' . $_SESSION [ 'email' ]; ?> </body> </html> Next we create another page demo2.php ,from this page we will access the session variables that we set ...
This blog is about solutions for PHP,Python,JavaScript,j query,HTML,CSS and Ubuntu.