I can't access a variable stored in a session

By going to oil-testimonials.com/110 the ID # of 110 is stored in the session. I have a variables.php page that I can goto to prove this:

Array ( [referrer] => [sponsor] => 110 [colorBackground] => #D5E5D2 )

The problem is with one of my other pages that won’t pull the value stored in the sponsor variable. Here is my code:


/////////////////////////////////////////////////////////////////////////
// Grab variables out of the session
/////////////////////////////////////////////////////////////////////////

$colorBackground = $_SESSION['colorBackground'];
$sponsor = $_SERVER['sponsor'];

print ("The sponsor is - $sponsor");

I can’t figure out, for the life of me, why the sponsor number isn’t showing when I can see from the variables.php page that it’s properly setup. Any ideas?

Thanks!!

Because you’re using $_SERVER, and not $_SESSION ? :wink:

God bless you for pointing out the obvious. Thanks brother!

Ok, I’m stuck again. Ugh! I can now echo the value of $sponsor. But later down in my code, when I do an insert into the database, the value is lost again. Any idea what is causing this?

Show us the insert code please busboy

I figured it out guys. Thanks for all your help!