|
Posted by shimmyshack on 03/05/07 10:58
On 4 Mar, 22:57, "J.O. Aho" <u...@example.net> wrote:
> rsvore wrote:
> > Currently the destroy is at the end of the script but if I'm on step one of
> > the form and go to step two and decide to go back to step 1 by using the
> > back button in IE it destroys session the step1 values and I have to
> > repopulate the fields. I have an include that pulls the DB population script
> > so I will try the destroy there.
>
> I would put in an extra page in the beginning, as you have it now, I guess, is:
>
> page with link to form
>
> first form page
>
> second form page
>
> ...
>
> yes or no page
>
> kill session page
>
> This has the funny thing that you recreate a session if you use the backwards
> buttons and I guess thats what makes your session to be recreated. Do this
> instead:
>
> page with link to form
>
> page creates session and then forward to next page with header()
>
> first form page
>
> second form page
>
> ...
>
> yes or no page
>
> kill session page
>
> When you back from "first form page" you will come to "page with link to form"
> without a new session is created. No new session is created when you go from
> "second form page" to "first form page" as the session isn't created on that page.
>
> Of course you can keep things like it is, but you have to check if there is a
> session or not when you load "first form page", if none detected create a new
> session, if session detected don't do anything.
>
> I hope you did follow this quite late evening post.
>
> --
>
> //Aho
can I just clarify, if there is already an exsisting session, why
doesn't the call to session_start() pick up on that fact and refuse to
create a new session.
php manual: "session_start() creates a session or resumes the current
one based on the current session id that's being passed via a request,
such as GET, POST, or a cookie"
It seems to me that was must be happening at the moment, for data to
be lost is that the variables are pushed to a completely new session
each time the form POSTs, this just seems to defeat the point of
sessions to me?
[Back to original message]
|