Home Tutorial Php Examples Printing username,email Id using session variable.

 
 

Printing username,email Id using session variable.
Posted on: July 31, 2009 at 12:00 AM
In this example you will learn about printing username, email Id using session variable.

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.

Related Tags for Printing username,email Id using session variable.:


Ask Questions?

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.