[PHP] Re: [Repost] Getting rid of Web page has expired (POSTDATA Error)
You might want to modify your coding. The way I prevent this problem from ever happening is this: 1. The user completes information on the form. 2. The form is validated by PHP. 3. If there are errors, then the form is reshown with their values populated. 4. Once all errors are corrected, I process the form and then use a Header(Location: ) to redirect the user to the same page (or another page). This has the advantage of allowing a user to click the back button and seeing their form with their values still intact. This prevents a method post page from being in the user's browser history.
RE: [PHP] Re: [Repost] Getting rid of Web page has expired (POSTDATA Error)
Robert Samuel White wrote: You might want to modify your coding. The way I prevent this problem from ever happening is this: 1. The user completes information on the form. 2. The form is validated by PHP. 3. If there are errors, then the form is reshown with their values populated. 4. Once all errors are corrected, I process the form and then use a Header(Location: ) to redirect the user to the same page (or another page). This has the advantage of allowing a user to click the back button and seeing their form with their values still intact. This prevents a method post page from being in the user's browser history. Robert, I do the three first items but not the last one (#3 is done both client-side and server-side by the way). I can add a hard redirect but I am a bit surprised that it should fix the issue. Yet I see it in Chris Shiflett's article at http://shiflett.org/articles/guru-speak-nov2004 He also advises to add ini_set('session.cache_limiter', 'private'); Can somebody explain the login behind the redirect? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [Repost] Getting rid of Web page has expired (POSTDATA Error)
Robert Samuel White wrote: You might want to modify your coding. The way I prevent this problem from ever happening is this: 1. The user completes information on the form. 2. The form is validated by PHP. 3. If there are errors, then the form is reshown with their values populated. 4. Once all errors are corrected, I process the form and then use a Header(Location: ) to redirect the user to the same page (or another page). This has the advantage of allowing a user to click the back button and seeing their form with their values still intact. This prevents a method post page from being in the user's browser history. Now one thing bothers me: how do you redirect in step 4 if you have shown the form in step 3? How do you avoid a Cannot modify header information - headers already sent by ... error message? Nicolas Verhaeghe E-mail: [EMAIL PROTECTED] Phone: 602-490-8000 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [Repost] Getting rid of Web page has expired (POSTDATA Error)
[SNIP] Now one thing bothers me: how do you redirect in step 4 if you have shown the form in step 3? How do you avoid a Cannot modify header information - headers already sent by ... error message? Nicolas Verhaeghe E-mail: [EMAIL PROTECTED] Phone: 602-490-8000 [/SNIP] Nicholas, As long as you haven't outputted anything from your script after the form post, you can redirect just fine. Step 3 and Step 4 are two different steps. You need something like this: if (isset($_POST[btnSubmit])) { // validate form } if (!$form_passes_validation) { // show form } else { Header(location: ); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [Repost] Getting rid of Web page has expired (POSTDATA Error)
Robert Samuel White wrote: [SNIP] Now one thing bothers me: how do you redirect in step 4 if you have shown the form in step 3? How do you avoid a Cannot modify header information - headers already sent by ... error message? Nicolas Verhaeghe E-mail: [EMAIL PROTECTED] Phone: 602-490-8000 [/SNIP] Nicholas, As long as you haven't outputted anything from your script after the form post, you can redirect just fine. Step 3 and Step 4 are two different steps. You need something like this: if (isset($_POST[btnSubmit])) { // validate form } if (!$form_passes_validation) { // show form } else { Header(location: ); } Indeed but you specify that you reshow the form and then redirect... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [Repost] Getting rid of Web page has expired (POSTDATA Error)
Nicolas Verhaeghe wrote: Indeed but you specify that you reshow the form and then redirect... Actually, he said: If there are errors, then the form is reshown with their values populated. His code from above that matches this statement is: if (!$form_passes_validation) In his example and explanation, the header() function only gets called if there are no errors. Hope that helps. Chris -- Chris Shiflett Principal, OmniTI http://omniti.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php