Sessions Lose Form Field Data When Back Button Used?
| From: | Instruct ICC | Date: | Mon, 16 Jul 2007 17:33:57 +0000 |
| Subject: | Sessions Lose Form Field Data When Back Button Used? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-258945@lists.php.net to get a copy of this message | ||
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.
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.
I do not want to modify all my old pages to use this technique for every field http://marc.info/?l=php-general&m=118200948606904&w=2 simply because I want 1 session variable passed around.
I even modified my code to check for isset($_SESSION) to not call session_start again, but no joy.
Thanks.
_________________________________________________________________
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507