I struggled with this one as well and the solution is quite simple;

1.  Every PHP module that is reached via the action field in a form where
the method is POST (most of mine are) never outputs any html except a http
redirect (it will edit values, update the database, save session data, then
does a redirect).

header("Location:.....");

2.  Every PHP module that is reached via a hotlink or redirect (above) is
free to output html to the browser, acting on or displaying data from the
database, using session data, or data coded in the URL parameter list;

Mymodule.php?parm1=aaaa&parm2=bbbb&parm3=cccc

$a = $_GET["parm1"];    // like this
$b = $_GET["parm2"];
$c = $_GET["parm3"];

With these two types of modules, you can build your entire application.  I
believe the cause of this problem is that most browsers don't save "POST"
data in the history stack, when you click the back button and the browser
detects that the previous page was entered via a "POST" is knows it doesn't
have enough saved information to reconstruct the page (passed data is
missing, and complains).  I also believe the browser replaces an entry in
the history stack (i.e. your form POST) when it receives a redirect url,
effectively removing all url's that had been entered with a POST from the
history stack and replacing them with "GET" requests.

Good luck,

Warren Vail

-----Original Message-----
From: Michael Gale [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 27, 2004 2:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Browser back button


Hello,

        I am sure this has been asked more then a few times but ... I have a
web site where almost every page is dynamically created. So if at some point
in the site if you hit your browsers back button a popup window occurs and
asks if you want to resubmit the data. Upon clicking yes the page is
properly displayed.

That is a pain in the a$$ and I get many user complaints -- so far I have
thought about saving the requested URL and query string in a session
variable and loading a back button on every page.

This seems to work create if the previous page can be loaded using a GET
request but if the previous page was loaded using a HTTP POST it seems I an
up the creek with out a paddle :(

Any one have any ideas ... 

Thanks ..

-- 
Michael Gale
Network Administrator
Utilitran Corporation

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

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

Reply via email to