title: PHP avoid browser reposting $_POST on page refresh?
body: <p>I wonder what are the techniques i can use to avoid users to post form twice when they refresh page and chose submit again?</p>
  
  <p>e.g. i have form inside <strong>regiter.php</strong> and process it as well inside <strong>register.php.</strong></p>
  
  <p><strong>1st</strong> i could process in another file e.g. <strong>register_process.php</strong> and redirect to register.php, but then i have to create about 20 new pages and relocate a lot of code, i dont want that option.</p>
  
  <p><strong>2nd</strong> i could play with <code>headers</code> i dont remember exact trick but had some bad experience with that - users seen old data on page after refreshing it...</p>
  
  <p><strong>3rd</strong> i could just redirect upon success to some <strong>dummy.php</strong> and from <strong>dummy.php</strong> jump back to <strong>register.php</strong> then even if they refresh page browser would not re-post, however it does not protect against them using <strong>back button</strong> and choosing re-post, i know i could expire page, but i find that annoying experience for me and probably other users to see page expired error.</p>
  
  <p><strong>4th</strong> use some unique "access key" for each form once page loaded that will post with form and once used cannot be reused, however i kind of struggle with logics of that feature. how do know key was used without storing it in MySQL DB, i think time based accesis not great either because some users can take long between page open and form submit.</p>
  
  <p>I need more suggestions how to avoid users reposing form again.</p>