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 8987497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:48:31+00:00 2026-06-15T21:48:31+00:00

I wonder what are the techniques i can use to avoid users to post

  • 0

I wonder what are the techniques i can use to avoid users to post form twice when they refresh page and chose submit again?

e.g. i have form inside regiter.php and process it as well inside register.php.

1st i could process in another file e.g. register_process.php 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.

2nd i could play with headers i dont remember exact trick but had some bad experience with that – users seen old data on page after refreshing it…

3rd i could just redirect upon success to some dummy.php and from dummy.php jump back to register.php then even if they refresh page browser would not re-post, however it does not protect against them using back button 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.

4th 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.

I need more suggestions how to avoid users reposing form again.

  • 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-15T21:48:33+00:00Added an answer on June 15, 2026 at 9:48 pm

    Try this:

    <?php
    session_start();
    if( strcasecmp($_SERVER['REQUEST_METHOD'],"POST") === 0) {
      $_SESSION['postdata'] = $_POST;
      header("Location: ".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']);
      exit;
    }
    if( isset($_SESSION['postdata'])) {
      $_POST = $_SESSION['postdata'];
      unset($_SESSION['postdata']);
    }
    

    This will basically save the POST data and cause the browser to re-request as a GET request.

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

Sidebar

Related Questions

I wonder how can I use similar to Eclipse's remote debugging technique to get
i'm using spring+tapestry for authenticate webuser. I wonder is there any technique i can
I wonder if anyone can think of a good technique to enable any arbitrary
wonder whether someone can help me with the following one... I have a struct
I wonder about that can I write native SQL to add or delete operations
I wonder what techniques xfire and/or Steam uses to overlay into games. I'm trying
I've been searching with no good results. I wonder if the techniques explained in
My work should use parallel techniques, and I am new user of Python. I
I wonder where should we use lambda expression over functor in C++. To me,
I wonder how can android gallery show large images without resizing them. In my

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.