Why is my $_SESSION
data not being preserved across pages? I can access $_SESSION
data over and over on the same page, but not from any page other than the one it was set on.
Index.php (Set attempt):
<?php
session_start();
$_SESSION['TEST'] = '1';
?>
<!doctype html>
<html lang="en">
<head>
<title>Title</title>
</head>
<body>
<h1>Heading</h1>
<a href="PageTWO.php">Page TWO</a>
</body>
</html>
PageTWO.php (Get attempt):
<?php
session_start();
?>
<!doctype html>
<html lang="en-us">
<head>
<title>Title</title>
</head>
<body>
<?
echo $_SESSION['TEST'];
?>
</body>
</html>