Hi,
I've a file login.php that create a session, register a variable(myVar) and
call (include) another file login1.php in the server side.
I need to use the registred variable in the second file but
$_SESSION["myVar"] is empty.
here is a simplified example of my problem, the command echo
($_SESSION["myVar"]) isn't displaying any thing
login.php :
========
<?php
$myVar="test"
session_start() ;
session_registe r("myVar");
include("login1 .php");
?>
login1.php :
=======
<?php
session_start() ;
echo ($_SESSION["myVar"]);
?>
Note: I need to have myVar in the $_SESSION array in login1.php because in
other context I call it from the browser, so I'll the same code.
Thanks.
I've a file login.php that create a session, register a variable(myVar) and
call (include) another file login1.php in the server side.
I need to use the registred variable in the second file but
$_SESSION["myVar"] is empty.
here is a simplified example of my problem, the command echo
($_SESSION["myVar"]) isn't displaying any thing
login.php :
========
<?php
$myVar="test"
session_start() ;
session_registe r("myVar");
include("login1 .php");
?>
login1.php :
=======
<?php
session_start() ;
echo ($_SESSION["myVar"]);
?>
Note: I need to have myVar in the $_SESSION array in login1.php because in
other context I call it from the browser, so I'll the same code.
Thanks.
Comment