Forum Moderators: coopster

Message Too Old, No Replies

How to Go Back without re-posting?

         

erikcw

9:47 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



Hi all,

Iv've noticed that my browser always asks if I want to re-post the form data when I click the back button after posting a form to my script. I have noticed some sites that use forms without the back button triggering that dialog. How are they doing this? Are they posting to another script which redirects after processing?

Thanks!
Erik

ironik

10:33 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



If you need to get back to the page after posting data you can use the

header('location: myform.php');

to redirect after successfully completing the form (I recomment prepending the myform.php with a full URL). If you go to a page that is processing POST data it will normally always ask if you want to re-submit the data (depending on what browser you use), a re-direct will load the page without POST headers (unless you specify them).