PHP Sessions

A session is used to store information on the server:
NOTE: This information can then be used in any part of the website.

How to use a session:

Start session -> Create session -> Use the session -> End Session


The code

1.)  To start session


// Start the sessionsession_start();
?>


2.) To Create session



// Set session variables$_SESSION["my_name"] = "tobi";

?>

3.) Use the session


// Echo session variables that were set on previous pageecho "My name is " . $_SESSION["my_name"];
?>


4. To end session


// Remove all save sessionssession_destroy();
?>


This is it about sessions.


Post a Comment

0 Comments