Clearing Post Data with IE - PHP
This is a discussion on Clearing Post Data with IE - PHP ; Hey,
Im writing a script for a poll, and im trying to figure out how to clear the
_post.
Right now i post the response that the user selected from the poll, back to
the poll page, which then displays ...
-
Clearing Post Data with IE
Hey,
Im writing a script for a poll, and im trying to figure out how to clear the
_post.
Right now i post the response that the user selected from the poll, back to
the poll page, which then displays the results
The way it works right now, if i try to refresh the page, IE will pop a
dialog back asking me if i want to resubmit the post.
Is there a way to get it so that i can clear _post and get it so they arent
in the header??
Chris
-
Re: Clearing Post Data with IE
Using "Pragma: private" instead of no-cache would elminate that message
about cache expired and asking if you want to resubmit. However, based on
your questions. It's not the answer you're looking for. So, there is a
better way around. Just do Webpage #1 for form and submit it to Webpage #2
for processing the form like the database or session for example, then use
the header("Location: ****") to get to Webpage #3 where you can display the
result. That way, Webpage #2 was never reached to the web-browser and was
never cached.
FletchSOD
"Chris Thomas" <chris@designvariation.com> wrote in message
news:20040322212408.28888.qmail@pb1.pair.com...
> Hey,
> Im writing a script for a poll, and im trying to figure out how to clear
the
> _post.
> Right now i post the response that the user selected from the poll, back
to
> the poll page, which then displays the results
>
> The way it works right now, if i try to refresh the page, IE will pop a
> dialog back asking me if i want to resubmit the post.
>
> Is there a way to get it so that i can clear _post and get it so they
arent
> in the header??
>
> Chris
-
Re: [PHP] Clearing Post Data with IE
> Is there a way to get it so that i can clear _post and get it so they
arent
> in the header??
After you've finished all of the processing, just do:
header( 'location: ' . $_SERVER['PHP_SELF'] );
exit();
Chris
-
Re: [PHP] Clearing Post Data with IE
I tried using the Header('location: ....') but it seems the posted data
follows the redirection
Im going from my main page to a processing page then back to my main page.
i printed $_POST on the main page and it still has the values that were
originally posted to the
processing page. Also after the redirection the address in the address bar
is that of the processing page
Here is some code to help explain:
--index.php
print_r($_POST);
....
echo "<form action='poll.php' method='POST'>";
echo "<input name='poll_id' type='hidden' value='$poll_id'>\n";
echo "<input name='calling' type='hidden' value='" .
$_SERVER['PHP_SELF'] . "'>\n";
foreach($poll->choices as $id => $choice) {
echo "<input name='poll_choice' type='radio' value=$choice->id
>$choice->choice<br>\n";
}
echo "<input type='submit' value='submit'>";
echo "</form>";
--poll.php
$poll_id = $_POST['poll_id'];
$poll_choice = $_POST['poll_choice'];
$calling = $_POST['calling'];
if (isset($poll_id)) {
unset($_POST);
Header("Location: $calling");
exit();
}
When poll.php loads up index.php the Posted data is still there.
Chris
"Chris Boget" <chris@wild.net> wrote in message
news:01c101c41106$678a4f50$8c01a8c0@entropy...
> > Is there a way to get it so that i can clear _post and get it so they
> arent
> > in the header??
>
> After you've finished all of the processing, just do:
>
> header( 'location: ' . $_SERVER['PHP_SELF'] );
> exit();
>
> Chris