Re: Using Header() to pass information...
| From: | Stut | Date: | Tue, 25 Apr 2006 21:47:43 +0000 |
| Subject: | Re: Using Header() to pass information... | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234734@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
On Tue, April 25, 2006 12:47 pm, Stut wrote:Indeed, but that's not the issue. Consider these sequences... 1) User fills in form and submits it 2) Form action script processes the form and simply outputs the page Then either... 3a) User hits back... form gets shown, hopefully (dependant on browser/cache settings) with the data the user had entered previously on it - No bad stuff here or... 3b) User clicks on a normal link, goes to another page then hits back... user sees an evil-looking and unexpected question asking whether to resubmit the form values. Most users I know will hit OK because they don't understand it. This is bad, form gets submitted again. In the case where they hit cancel instead they end up with an error message and have effectively left your site... also very bad. Better... 1) User fills in form and submits it 2) Form action script processes the form and redirects to the next page As before, either... 3a) User hits back... same thing as before happens, form is displayed hopefully with previously entered data or... 3b) User clicks on a normal link, then hits back... since the post page never ended up in the browser history this action has the same effect as in 3a, showing the form hopefully with previously entered data. If the user then submits the form again that's their choice, but in theory at least it's a better informed choice than the previous scenario. In my most humble opinion, any post handler that doesn't do a redirect after processing the form is bad. Hope that made sense. -StutAs long as we're throwing foreign money into the ring, I'd just like to say that I make a point of redirecting to another page after a post request, otherwise you get unsightly errors in the browser when the user tries to use the back/forward buttons. Other than in that situation I make sure I do includes rather than redirects.There are viable alternatives to breaking the back button... Not to mention that it's sometimes VERY useful to be able to use a browser that lets one re-submit a form with altered data with the back button, rather than going through the process from the beginning. Though that is application-specific.