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

  • SEARCH
  • Home
  • 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 6825395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:01:05+00:00 2026-05-26T22:01:05+00:00

So as the title says i want to prevent user from keep submiting $_POST

  • 0

So as the title says i want to prevent user from keep submiting $_POST data to my database.

Now what i have is form and simple class for submiting form data to my database. The problem is that if user submits data and refreshes browser it would submit same data again.

I know i could refresh page by my self with meta or by using headers, but i don’t wanna do something so stupid, so i guess i could just do something like $_POST = null; not sure if that works but i actualy wanna keep all post data because if some errors appears i want to populate my form with previous post data…

Anyways i hope you guys get what i wanna do here and can help me a little 😀

  • 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-05-26T22:01:05+00:00Added an answer on May 26, 2026 at 10:01 pm

    The simple solution is you should redirect users after form submission and procession on that data.

    You could make a check if the data is successfully submitted and processed redirect users otherwise don’t redirect them this can keep $_POST data to re-populate fields.

    This will prevent re-submission of form.

    General Pseudocode

    if (isset($_POST['submit']))
    {
        if(validate() == true)
        {
            //passed the validation
           // do further procession and insert into db
           //redirect users to another page 
          header('location:someurl'); die();
        }
        else
        {
           $error='Validation failed';
           // do not redirect keep on the same page 
           // so that you have $_POST to re populate fields
        }   
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the title says, i want to retrieve my Json data values from a
I just want what my title says.I have already read all the previous similar
The title says it mostly. If I have an object in Python and want
As the title says I have a list of Django objects and I want
As the title says I want to remove the first 4 letters from a
As the title says I want to transfer data, in this case the information
Like the title says, I want to have a HTML table that allows its
As the title says, I want to have a build tool that quite much
As the title says, I want to bind a property from my ViewModel to
As the title says, I want to output 2 .msi files from one project

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.