how to use session in php | session sart in php
<?php php session_start(); ?>
<html>
<?php
$var="saddam";
$_SESSION['user']=$var;
if(isset($_SESSION['user']))
{
$_SESSION['user']=$_SESSION['user']+1;
}
else
{
$_SESSION['saddam_password']=1;
}
?>
<body>
<?php
echo "Hi ".$_SESSION['user']. " You have visited ".$_SESSION['user']." pages";
?>
</body>
</html>
step by step:
1 star session top of the page using session_start() php function;
2 define your varibale like this $_SESSION['user']=saddam
3 print your variable like this echo $_SESSION['user']
Comments
Post a Comment