Here's my login code where I set the session:
<?php
session_start();
foreach ($query_result as $rows) {
if (($rows['admin_username'] == $username) && ($rows['admin_password'] == $password)) {
$_SESSION['valid'] = true;
$_SESSION['timeout'] = time();
$_SESSION['username'] = $username;
$match_flag = true;
break;
}
}
And it is my next file code where session is not accessible:
<?php
session_start();
echo " session value username is: ";
var_dump($_SESSION['username']); exit();
?>
It works perfectly on localhost but when I run it on the server, it will print NULL in session values.
Please help me regarding this issue.