sessions

PHP Sessions

PHP Sessions

Sessions are used to store information across multiple pages in a website. PHP sessions allow you to store data on the server and link it to a specific user.

Starting a Session

To start a session, use session_start():

      
        <?php
          session_start();
          $_SESSION['username'] = 'JohnDoe'; // Store session data
          echo "Session started!";
        ?>
      
    

Accessing Session Data