$_SESSION

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
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

$_SESSION

Post by JackD »

If I set values into $_SESSION, such as $_SESSION['EAN']='9781234', it does not get carried from one page to another. For example, if I set the value in search.php, and search.php invokes detail.php, when detail.php is invoked, $_SESSION has only the element for hreferer.

Am I doing something wrong? Is there a way to make this a global variable array from one page to another?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: $_SESSION

Post by requinix »

You remember to call session_start?

Post code.
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

Re: $_SESSION

Post by JackD »

Thanks! I did not know I had to do that.
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

Re: $_SESSION

Post by JackD »

Here is what I put in:

Code: Select all

 
if (!$Session_ID=session_id()) 
{ session_start(); 
  session_cache_limiter('none');  
  session_cache_expire(120); // in minutes   
  ob_start(); 
} 
 
$Session_ID was returned as "", but when the session_start() executed, I got the error:

Error: E_WARNING
session_start()[function.session-start]: Node no longer exists at detail.php line 3.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: $_SESSION

Post by requinix »

Are you trying to put some SimpleXML stuff in the session? Right now you can't really do that and need to find another way of doing what you want.
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

Re: $_SESSION

Post by JackD »

That could be it..... I believe I do have some of that later on in the script.

Thanks
Post Reply