NYCPHP Meetup

NYPHP.org

[nycphp-talk] form posts, back button, IE page expired

Wellington Fan wfan at encogent.com
Mon Aug 18 18:06:11 EDT 2003


Folks,

I have always thought that the underlying problem is that when a page is
requested via POST, most browsers will be (understandably) hesitant about
re-POSTING all the data that was sent to draw the page, hence the warning
messages.

I've restructured my apps, whereever applicable, to POST to a backend script
that NEVER prints to the browser, but at the end of its processing, redirects
to a 'landing' page:

[form page] -(SUBMITS TO)-> [backend page] -(REDIRECTS TO)-> [landing page]

1. formpage.php: page with form elements; user fills and submits to
backend.php
2. backend.php: does processing AND NEVER PRINTS ANYTHING TO BROWSER.
	a. Save the submitted data to a session var if you'd like (
unset($_SESSION['form']); $_SESSION['form'] = $_POST; )
	b. Process data (insert into db, etc.)
	c. Redirect to landing page ( header('Location: landingpage.php'); )
3. landingpage.php (or, formpage.php?mode=complete ) : Can use
$_SESSION['form'] if need be to echo user-supplied data.

No matter cache settings (which can be complex, and not all cache settings are
respected by all browsers AND there are both proxy caches and browser caches,
etc, etc....), this scheme has worked well for me -- I never have the 'expired
page' errors I used to have.

Please provide constructive criticism or comments about this!

Thanks,

Wellington





> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Analysis & Solutions
> Sent: Monday, August 18, 2003 4:12 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] form posts, back button, IE page expired
>
>
> Brian:
>
> On Mon, Aug 18, 2003 at 04:08:42PM -0400, Brian Pang wrote:
> >
> > How do you guys/gals deal with the IE Page Expired page which is
> > generated if you use the back button to return to a page which had form
> > POST information in it originally?
>
> Sounds like you/your server is setting cache headers.  Don't.  Then your
> problems will disappear.
>
> Enjoy,
>
> --Dan
>




More information about the talk mailing list