Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:31:25+00:00 2026-06-07T03:31:25+00:00

There are many interesting articles on the Post Redirect Get pattern for example here:

  • 0

There are many interesting articles on the Post Redirect Get pattern for example here: http://www.theserverside.com/news/1365146/Redirect-After-Post

But here’s a simple question…

If the user does POST and is redirected to a GET. Fine if they hit refresh the browser just sends GET, easy to understand. But if the hit the BACK button after the GET and then hit refresh they can surely hit the POST again? yeah?

I am trying to understand how we can be 100% sure the POST can never be resubmitted?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:31:26+00:00Added an answer on June 7, 2026 at 3:31 am

    One method for ensuring that a POST is not resubmitted is have a unique identifier associated with that post session, for example, if it’s a shopping cart, when they begin checking out, generate a unique ID for that process. Once the checkout has completed (e.g. POST has been sent), remove that ID from the ID’s that can be used.

    You could also do this by generating a unique key with the form, and if the form is submitted, remove that key from where it is stored.

    <input type="hidden" name="key" value="<?php echo generateUniqueKey(); ?>" />
    

    where the generateUniqueKey() function will query a table and insert a unique ID, then return the ID. On the page where you are processing the form, do something like this:

    <?php 
        $key = $_POST['key'];
        if (isKeyStillValid ($key)) {
            markKeyAsInvalid ($key);
            // Process form ...
        }
        else {
            die ("You have already submitted this form".);
        }
    ?>
    

    Where the isKeyStillValid() function will check the database to ensure the key used with the form is still a useable key, and the markKeyAsInvalid() function will remove the key from the database.

    Update:
    Here’s an example that I just made which involves exactly what I described earlier. This is a very simple example, and simply uses an auto-incrementing ID in a SQL table as the key, but it should be sufficient as an example. Realistically, you would want something more thought out than this.
    http://alexloney.com/post/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's something interesting, turnsout that many people out there had this problem, but i
There are many conflicting statements around. What is the best way to get the
There're many ways to write an HTTP-status header: HTTP/1.1 404 Not Found Status: 404
After reading some interesting posts here on SO, and many pages found on google,
There are many ways of converting a String to an Integer object. Which is
There are many things that all programmers should know, but I am particularly interested
There are many instances where we are not happy with the decisions that Oracle's
There are many systems that depend on the uniqueness of some particular value. Anything
There's many regex's out there to match a URL. However, I'm trying to match
There are many Cocoa methods that require an NSError object as a parameter to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.