php - Why isn't $_SESSION data being preserved across pages? -
why $_session
data not being preserved across pages? can access $_session
data on , on over same page, not page other 1 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>
problem in php tag.
your tag should be
<?php echo $_session['test']; ?>
Comments
Post a Comment