Preventing Form Resubmission on Page Refresh in PHP


Redirect after a form submission to prevent resubmission.

Source Code

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Process form
    header("Location: ".$_SERVER['PHP_SELF']);
    exit;
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments