I am new in PHP. I want to use session with variable. Its my first experience to play with session. I create 4 pages.
1. is session1.php
<?php
session_start();
$_SESSION['UserID']='1';
?>
2. is session.php
<?php
// starts session
session_start();
if($_SESSION['UserID']='1')
{
header("location: user.php");
}
if($_SESSION['UserID']='2')
{
header("location: mang.php");
}
?>
3.user.php
<?php
echo "This is User page";
?>
4.mang.php
<?php
echo "This is manager page";
?>
In my code there is problem of IF condition. My IF condition is not working. Can you guys please help to sort out my problem.
$_SESSION['UserID']='2'to$_SESSION['UserID']=='2'