Jump to content

Session works in same page, but won't pass from page to page.


dprichard

Recommended Posts

Okay, I was working on a login script and having tons of issues so I made a small script to test sessions and if I echo the session out on the page I am on it works, but if I try to pass it from one page to another it doesn't.  I am lost as to what may be causing this.

 

Any help would be greatly appreciated.

 

Here is what I am using to test it with.

 

test1.php

 

<?php
session_start();
$_SESSION['UID'] = 'Test';
echo '<a href="test2.php">link</a>';
?>

 

test2.php

 

<?php
session_start();
echo $_SESSION['test'];
?>

 

When I get to test two I get the following error.

 

Notice: Undefined index: test on line 3

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.