Passing data between pages with $_SESSION
I am having difficulty with this. To test I made two simple pages passing data from one to the next.
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
// Echo session variables that were set on previous page
echo "Favorite color is " . $_SESSION["favcolor"] . ".<br>";
echo "Favorite animal is " . $_SESSION["favanimal"] . ".";
Favorite color is .
Favorite animal is .NULL
The session ID is the same on both pages. What else should I be checking?