I am Creating a Login System but Unable to access Session Variables on other pages... I have two php files - (1).check_login.php and (2). test.php
(1).check_login.php
<?php
include 'connection.php';
$tbl_name = "guests";
if(isset($_POST['login'])){
$mobile = mysqli_real_escape_string($conn,$_POST['mobile']);
$pass = mysqli_real_escape_string($conn,$_POST['password']);
$sel_guest = "select * from guests where MobileNumber='$mobile' AND Password='$pass'";
$result = mysqli_query($conn, $sel_guest);
$count = mysqli_num_rows($result);
if($count>0){
$_SESSION['umobile']=$mobile;
echo "<script>alert('".$_SESSION['umobile']."')</script>";
//echo "<script>window.open('index.php','_self')</script>";
}
else {
echo "<script>alert('Email or password is not correct, try again!')</script>";
}
echo "<script>alert('".$_SESSION['umobile']."')</script>";
}
?>
(2). test.php
<?php
session_start();
echo "alert(".$_SESSION['umobile'].")";
echo session_status();
?>
Thanks in Advance...