i have simple example
put these 2 files at the root/ in my case wamp server, the root is the www directory.
then bring up test3a.php in browser (ie or firefox)
when you click the button, session variables are set, then you get re-directed to test3b.php within same directory. . . .
but SESSION variables are not set
=================
this is test3a.php
=================
Code: Select all
<?php
session_start();
if (isset($_POST['submit']))
{
echo "redesplay after submit button";
$_SESSION['test'] = 'torvic';
//
$root = "http://127.0.0.1/";
header("Location: " . $root . "/test3b.php");
die();
}
?>
<form action="test3a.php" method="post">
<input type="submit" name="submit" id="submit" value="Login!">
</form>
=================
this is test3b.php
=================
Code: Select all
<?php
session_start();
if(isset($_SESSION['test']))
{
echo $_SESSION['test'];
}
else
{
echo "session var not set";
}
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
?>
1- bring up test3a.php in firefox 3.6.8
2- i click the "Login" button
3- i get redirected to test3b.php, but this is what i see on the browser:
<<<<<<<<<<<<<<<<<<<<<<<<<<
session var not set
Array
(
)
>>>>>>>>>>>>>>>>>>>>>>>>>>