NYCPHP Meetup

NYPHP.org

[nycphp-talk] problem: session variables disappear after redirection

Rolan Yang rolan at omnistep.com
Wed Jun 13 22:14:22 EDT 2007


Michael Southwell wrote:
> Here is a baffling problem that piggybacks in a sense on recent
> discussions about form handling.  The situation is this:
>
> I have a form which submits to a processor script. The processor
> writes the post variables into the session and checks for correctness.
> If there is a problem, it redirects to the form which is preloaded
> from the session, and we start over again. If there is no problem, the
> processor redirects to a thanks page which pulls the submitted
> information out of the session and sends it via email and says
> "thanks" to the submitter.
>
> This works perfectly for everybody except two out of about 400 people.
> Unfortunately one of those two is an officer of the organization.
>
> I have determined that, even for these two people, the processor does
> indeed receive the post variables and does indeed write them into the
> session. But (for those two people, and only for them) when we get to
> the thanks page, the session information is somehow lost in the course
> of the redirection, and so the email is sent with blank information.
>
> The two people for whom this is happening are both on Macs, and both
> experience the problem with both Safari and Firefox. Other Mac users
> with either browser have no problem.
>
> Can anyone imagine or suggest what might be happening here?
>
They may have cookies disabled .
If you're doing a javascript "onLoad" redirect or using http headers 
(ie. header("Location:http://www.yoursite.com")  the redirect may not be 
passing the session id onward.
It might be ugly, but to be safe, include the "session id" in the 
redirect url (eg, 
http://www.yoursite.com/formpage.php?SID=2932398f2398hf23983f )

~Rolan




More information about the talk mailing list