Re: Pages Expiring

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

 



This one has been around for years.  Here is my understanding;

* Form 1 invokes the code for Form 2 with a post (the data is passed separately to the server)
   * Your Browser saves the URL for Form 2 to the history list.
* Form 2 processes the data from form1 and displays another form (again with a post). * You fill out the form and click submit, causing control to be passed to Form 3, and your browser saves the URL for Form 3 in its history list, and gets data from form 2 via a separate connection (post again).
   * Form 3 displays gets something and the user clicks the back button.
* The browser looks in its history list and discovers it needs to redisplay form 2, and discovers that in order to redisplay Form 2 it needs not only the URL in the history list, but the post data which id did not save, and this is where the complaint comes from.

Here is the preferred PHP solution.
* break each php form entered with post data into two separate php modules. * the first php module accepts any post data from the previous form, processes the data, updating the database or storing the data in the session. * the first php module then redirects the browser to the second php module. header("Location: 2ndmodule.php?parm1=5&parm2=n");
   * The redirection causes two things to occur;
* The browser replaces the URL for the first module with the second, because it thinks the message means that the module has moved * Any parameters that needed to be passed to the second module are passed in the URL (which is saved by the browser, most information is already been applied to the database, etc). * The 2nd module gets what little information it needs from the URL and displays a resulting page by refetching the completed updates from the database. This means that when this page is stepped back to by the back button, the browser has everything it needs to reprepare the page.

Don't know if this is clear but put simply; each module that receives input of post data from a form should only do updates and should not output anything and when done should redirect the user to another separate page which will display the results by pulling results from the database (or session, or url "GET" string).

hope this helps,

Warren Vail


At 04:40 PM 1/5/2006, Ben Miller wrote:
When using forms with PHP sessions, hitting the back button results in
WARNING: Page has Expired

I am wondering if there is a work around for this so that it (IE, in this
case) resubmits the form information and displays the previous page.

Any ideas?

--
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