Session variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Session variables

Post by impulse() »

Any ideas why when in file A I specify

Code: Select all

session_start();
        $_SESSION['loggedIn'] = 1;
And then in file B I do

Code: Select all

echo $_SESSION['loggedIn'];
I get returned blank data, as if the value was never passed to the session variable?

Stephen,
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

you have to do session_start() in the second file as well... and turn on error reporting... it will help you figure this sort of thing out.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

The Ninja Space Goat wrote:you have to do session_start()
bingo bango bongo
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

I don't believe it. It was only a couple of weeks ago I was having the same problem and it turned out to be because I was using an online web proxy to view my website. And it's just occured to me again, it's because I'm using an online web proxy.


DOH!
Post Reply