----- Original Message -----
From: "Mark McCulligh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 20, 2003 11:44 AM
Subject: Re: [PHP] clearing cache


> I can't just create a link on the last page back to the first page.
Because
> if the user hits the back button on the browser they end up on page 2.
> Which can't happen.  Once you are on the last page the user can't by
anyway
> get back to page 2, unless they start over on page 1.
>
> What I am planning on doing is passing the variables using the POST
method.
> Then have a hidden variable pass with the pages.  If this hidden variable
is
> missing then redirect the user back to page 1.  Thus if I can get page 2
to
> be cleared from the browsers cache after it has been displayed, if the
user
> came back to this page using the back button the page will be reload from
> the server because it is not in cache, there for my code will not find the
> hidden variable and redirect the user back to page 1.
>
> I think the theory of this will work ok, but I don't know how to clear a
> page from the browsers cache after it is displayed.
>
> Thanks,
> Mark.

[SNIP]

Mark, this is kind of a lame hack but give it a try...

/** PAGE A (first form) **/
<?
session_start();
if (isset($_POST['submit'])) {
 header("Location: test3.php");
 exit;
}
?>

/** PAGE B (second form) **/
<?
session_start();
if ($_SESSION['startover']) {
 $_SESSION['startover'] = false;
 header("Location: test2.php");
 exit;
}

if (isset($_POST['submit'])) {
 header("Location: test4.php");
 exit;
}
?>

/** PAGE C (results page) **/
<?
session_start();
$_SESSION['startover'] = true;
?>


The idea is to keep a "startover" variable in the session.  The variable is
set when you reach Page C (the results page).  When the user hits the back
button the variable is tested on Page B for true or false.  If it's true
header() redirect back to Page A.  Otherwise it prints and/or validates the
form on Page B.

Why header() redirect between each page?  Becuase it overwrites the post
data allowing you to use your back button without a repost.  This results in
a much cleaner more controlable user interface.  If you need to pass form
data between forms then simply store the post data in the Session and
extract it on the next page.

If I'm right, what you're going to see in the browser's back button history
using this method is a single instance of PAGE A repeated for each cycle.

Good luck with this.

HTH,
Kevin



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

Reply via email to