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
Citizen
Forum Contributor
Posts: 300 Joined: Wed Jul 20, 2005 10:23 am
Post
by Citizen » Fri May 11, 2007 11:46 am
Basically, I have set $_SESSION['loggedin'] and its coming up fine in my root level pages but wont show up in my included pages.
So...
index.php echos $_SESSION['loggedin'] fine
- top.php includes leftbar.php
-- leftbar does not echo $_SESSION['loggedin']
any ideas?
guitarlvr
Forum Contributor
Posts: 245 Joined: Wed Mar 21, 2007 10:35 pm
Post
by guitarlvr » Fri May 11, 2007 11:47 am
could you please post the code you are running?
Wayne
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri May 11, 2007 11:56 am
Citizen wrote: index.php echos $_SESSION['loggedin'] fine
- top.php includes leftbar.php
index.php includes top.php?
Citizen
Forum Contributor
Posts: 300 Joined: Wed Jul 20, 2005 10:23 am
Post
by Citizen » Fri May 11, 2007 12:02 pm
Found the problem!
I was using an absolute path to include the leftbar.php instead of using a relative path. The page previously included fine but the session variables weren't working becuase of the absolute path.
Thanks though!
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri May 11, 2007 12:05 pm
If you were developing with display errors on you probably would have seen a notice that the file could not be included. Just a tip for future development.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri May 11, 2007 12:11 pm
Citizen wrote: The page previously included fine but the session variables weren't working becuase of the absolute path.
By "absolute path" you mean "sobsolute uri" like
http://serv.er/xyz/left.php ?
Citizen
Forum Contributor
Posts: 300 Joined: Wed Jul 20, 2005 10:23 am
Post
by Citizen » Fri May 11, 2007 12:25 pm
volka wrote: Citizen wrote: The page previously included fine but the session variables weren't working becuase of the absolute path.
By "absolute path" you mean "sobsolute uri" like
http://serv.er/xyz/left.php ?
Right.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri May 11, 2007 1:42 pm
[s]sobsolute[/s] -> absolute