I am trying to pass a value using a session from one page to another, but it says:
Notice: Undefined index: user_id in path\file.php on line 61
The file where I am creating a session is as follows:
// Checking for session, if not then start session
if (!isset($_SESSION)) {
session_start();
}
// Assigning user_id to session var
$_session['user_id'] = $row['user_id'];
This is the code by which, I am accessing the session variables:
if (!isset($_SESSION)) {
session_start();
}
// Trying to access session var (previously defined)
$user_id = $_session['user_id'];
Where I am making a mistake. How can I fix this?
Note: To those who thinks that this might be a duplicate question, my answer is: It might be, but none among that solved my issue. As mine is because of case sensitivity for global variable and rest others are not this issue.