Home of web learners


PHP session is used to stored data in server and also in user storage as cookie

Session have the identifier to identify user

Application of session are like log in,log out user

If you want to work with session,you have to start session of those script or page you are working at the beginning

Its like creating a pipe or path

So,how to start,its simple


When you start session,you can now work with session

Now we need to work with session variable

Lets start an example:

$_SESSION["username"] = "roy";

Here,we see that we create a session variable which key is username,so we can use it anywhere in the webpage from the user where it is created.

So it stored in the server for this user

Lets use it

echo $_SESSION["user"];



So,this upper example are in another page,here you see we do not assign $_SESSION['user'] ,but we get the value,because in the previous example we already stored it in the server,so it comes from the server


About webn3rd