[PHP] Why do some pages repeat a previous page's action(s) after redirect?
Hello, I have a form page and a processing page. After submitting the form the processing page does whatever it needs to do (insert a record, send back validation errors, etc.) After determing what to do it always redirects somewhere with header('Location: URL'); But sometimes when I'm back at the form page (after the redirect) and I refresh the page it does the previous page's actions again. And again and again. Why would it do that? Shouldn't a refresh just resubmit whatever is in the address bar and not go through a certain path? The only way I've found to make it stop redoing the previous page's actions is to put my cursor in the address bar and press enter. I don't remember seeing this behavior in the past so I wonder if it has something to do with Apache's or PHP's configuration. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
On 4/3/07, Chris W. Parker [EMAIL PROTECTED] wrote: Hello, I have a form page and a processing page. After submitting the form the processing page does whatever it needs to do (insert a record, send back validation errors, etc.) After determing what to do it always redirects somewhere with header('Location: URL'); But sometimes when I'm back at the form page (after the redirect) and I refresh the page it does the previous page's actions again. And again and again. Why would it do that? Shouldn't a refresh just resubmit whatever is in the address bar and not go through a certain path? The only way I've found to make it stop redoing the previous page's actions is to put my cursor in the address bar and press enter. I don't remember seeing this behavior in the past so I wonder if it has something to do with Apache's or PHP's configuration. Thanks, Chris. This is the only behavior i know of, a refresh action does the same action he did for loading the current page again. If you submit data to that page, it will resubmit the data. If you're using the Location:URL header entry, the browser doesn't saves this action as an action did by the browser itself, and so it will submit the data to the page where you redirect. If you want to bypass this, you should use the javascript window.location method instead. Tijnema -- 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
RE: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
I've seen this a lot with IE, it even warns you about it, the warning from IE is: The page cannot be refreshed without resending the information. Click Retry to send the information again, or click Cancel to return to the page that you were trying to view. And through all my days, when you click cancel, the work offline page appears instead of the page you were on.. Just another reason not to use IE But this was the only place I remembered that warning from Jake -Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 2:39 PM To: PHP Subject: [PHP] Why do some pages repeat a previous page's action(s) after redirect? Hello, I have a form page and a processing page. After submitting the form the processing page does whatever it needs to do (insert a record, send back validation errors, etc.) After determing what to do it always redirects somewhere with header('Location: URL'); But sometimes when I'm back at the form page (after the redirect) and I refresh the page it does the previous page's actions again. And again and again. Why would it do that? Shouldn't a refresh just resubmit whatever is in the address bar and not go through a certain path? The only way I've found to make it stop redoing the previous page's actions is to put my cursor in the address bar and press enter. I don't remember seeing this behavior in the past so I wonder if it has something to do with Apache's or PHP's configuration. Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.25/744 - Release Date: 4/3/2007 5:32 AM -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.25/744 - Release Date: 4/3/2007 5:32 AM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
On Tuesday, April 03, 2007 11:44 AM Tijnema ! mailto:[EMAIL PROTECTED] said: This is the only behavior i know of, a refresh action does the same action he did for loading the current page again. If you submit data to that page, it will resubmit the data. If you're using the Location:URL header entry, the browser doesn't saves this action as an action did by the browser itself, and so it will submit the data to the page where you redirect. If you want to bypass this, you should use the javascript window.location method instead. formpage.php: html form method=get action=process.php /form /html process.php: ?php // do stuff // ... header(Location: http://www.domain.com/formpage.php;); exit; ? With those two pages in mind you're saying that after I submit the form on formpage.php, do stuff on process.php, then get redirected back to formpage.php that it will replay my form submission when I hit refresh? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
Hi Chris, But sometimes when I'm back at the form page (after the redirect) and I refresh the page it does the previous page's actions again. Can you provide a raw HTTP dump of the complete scenario? Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
Tijnema wrote: If you're using the Location:URL header entry, the browser doesn't saves this action as an action did by the browser itself, and so it will submit the data to the page where you redirect. Either you misunderstood his question, or you misunderstand what header('Location: ...') does. Or both. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
On Tuesday, April 03, 2007 12:35 PM Chris Shiflett mailto:[EMAIL PROTECTED] said: But sometimes when I'm back at the form page (after the redirect) and I refresh the page it does the previous page's actions again. Can you provide a raw HTTP dump of the complete scenario? Two things: 1. How do I do that? 2. The issue has gone away. I don't know what I've done differently. I haven't changed the way I handle sessions, redirects, or form submission. All that stuff is still the same. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?
Can you provide a raw HTTP dump of the complete scenario? Two things: 1. How do I do that? Probably the easiest thing to do these days is use a Firefox extension like Firebug or LiveHTTPHeaders. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php