Wednesday, July 20, 2011

Is there a reason why a $_SESSION variable won't pass from one PHP page to another?

You call session_start too late. For cookie-based sessions, the session information must go in the header. But you call 'session_start' after you've already output a whole bunch of stuff. By that time, it's too late to put things in the header. You must call 'session_start' before even the 'DOCTYPE' tag.

No comments:

Post a Comment