I am using php session for accessing various values in different pages. Session is set but its not being accessible in different pages.
below is the code which i am using
in validation.php
session_start();
$_SESSION["username"] = $username;
$_SESSION["user_id"] = $user_id;
in profile.php
session_start();
$username = $_SESSION["username"];
$user_id = $_SESSION["user_id"];
but both the variables return null value but when i am using below code in validation.php is shows session is set
echo "<pre>";
print_r($_SESSION);
This gives proper output in validation.php but its not being accessed at profile.php
i have tried with
error_reporting(E_ALL);
after
session_start();
but nothing is happening.
Please help me out this.