会话开始后,会话变量不会传递到第三页

after starting a new session in my login.php i rediredct to home.php and load session variables successfully.But when i try to open menu.php from home.php and use session variables , those same variables are unndefined now. I echoed the session id after both page changes and its exactly the same. So can anyone please tell me why am i losing these variables?

login.php:

session_start();
 $_SESSION["user"]=$puser;
 $_SESSION["loggedin"]=true;
 echo "<script>window.open('../home.php','_self')</script>";

?>

home.php

require("php/objects.php");
session_start();
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]==true)
{
    $user=$_SESSION["user"];
    $_SESSION["loggedin"]=true;
    echo session_id();
    echo $_SESSION["loggedin"];
}
else
{
    echo "Login Error";
    echo "<script>window.open('default.html','_self')</script>";
    exit();
}``

?>

menu.php

require("objects.php");
session_start();
echo session_id();
echo $_SESSION["loggedin"];
/*if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]==true)
{
    $user=$_SESSION["user"];
    $utype=isset($user->salary)?"staff":"client";

}
else
{
    echo "Login Error";
    echo "<script>window.open('../default.html','_self')</script>";
    exit();
}*/``

?>

when i click a link in home.php with href=menu.php i get an error that index loggedin is undefined

I don't know what is in your objects.php, calling session should probably come before that.

session_start();
require("objects.php");
echo session_id();
echo $_SESSION["loggedin"];