javascriptphpcssajax

Confirm Form Resubmission issue in my web site


I'm currently developing a web site and the problem is when I refresh the page it will prompt a confirm form resubmission. How can I solve this issue?


Solution

  • Welcome to the world of HTML form validation!

    The most common solution to this problem is, once the form data has been validated and processed, issue a header command to show the confirmation page.

    if($bDataOK){
        header('Location: http://example.com/page_ok_message.php');
        exit;
    }
    else{
        //Show the current form again with error messages
    }
    

    Put this near the top of you PHP before other output is sent, otherwise you'll get error messages about sending headers too late.