Re: Sessions Lose Form Field Data When Back Button Used?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, July 16, 2007 12:33 pm, Instruct ICC wrote:
> I have an old PHP page without sessions.  When the user submits the
> form,
> and then clicks the browser back button, the prior form data is
> retained.

This is actually almost for sure browser dependent behaviour...

Some browsers will reset to blank, others will "remember" what you
typed last time.

It's got nothing to do with PHP and there is precious little you can
do about it, except trust that users chose the browser they preferred,
and they LIKE it the way it is, whichever way that is.

> If I now have that PHP page require another page that uses
> session_start,
> when the user submits the form, and then clicks the browser back
> button, the
> prior form data is lost.  In fact, I noticed that without the session,
> the
> web page does not reload from the server and is positioned at the
> bottom of
> the page where I left off by the "Submit" form button.  With sessions,
> the
> page actually reloads from the server, so of course the form fields
> are
> empty.  Is this normal behavior?  Can I have the page not reload from
> the
> server?  I thought I could pass the buck onto the user's browser
> setting,
> but the onus is upon my code.

It's still browser-dependent, really, but now your browser isn't doing
what YOU want for your form-filling-in-experience...

There's still nothing you can do about it from PHP, unless you want to
make the user who LIKES it that way have a miserable experience, since
you force their browser to not behave they way they expect it.

> I even modified my code to check for isset($_SESSION) to not call
> session_start again, but no joy.

You have to call session_start() on every request to have sessions
working in that request...  I doubt that you want to skip that for any
page involved in your FORM processing...

Ignore this "problem" for awhile and see if it doesn't go away.
(read: you realize it's not really a problem)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux