Printing User Name, Email Id and Address using session variable
Using $session() function, we can print user name, email id and address of the user.
<?php
session_start (); #session start
$email= "raj@rediffmail.com";
$name="Raj";
$address="Delhi";
$_SESSION["email"]=$email;
$_SESSION["name"]=$name;
$_SESSION["address"]=$address;
$session_email= $_SESSION["email"];
$session_name= $_SESSION["name"];
$session_address= $_SESSION["address"];
echo "Your Email ID is ".$session_email."<br>";
echo "Your Name is ".$session_name."<br>";
echo "Your Address is ".$session_address;
?>
The output of this program will:
Your Email id is raj@rediffmail.com
Your Name is Raj
Your Address is Delhi.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.