Page 1 of 1
Session variables in an include
Posted: Fri May 11, 2007 11:46 am
by Citizen
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?
Posted: Fri May 11, 2007 11:47 am
by guitarlvr
could you please post the code you are running?
Wayne
Re: Session variables in an include
Posted: Fri May 11, 2007 11:56 am
by volka
Citizen wrote:index.php echos $_SESSION['loggedin'] fine
- top.php includes leftbar.php
index.php includes top.php?
Posted: Fri May 11, 2007 12:02 pm
by Citizen
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!
Posted: Fri May 11, 2007 12:05 pm
by RobertGonzalez
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.
Posted: Fri May 11, 2007 12:11 pm
by volka
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?
Posted: Fri May 11, 2007 12:25 pm
by Citizen
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.
Posted: Fri May 11, 2007 1:42 pm
by volka

[s]sobsolute[/s] -> absolute