How can one prevent a confirmation window from appearing after submitting data in PHP?

To prevent a confirmation window from appearing after submitting data in PHP, you can use the header() function to redirect the user to a different page after the form submission is processed. This way, the user will not see the confirmation window when they refresh the page.

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Process form data here

    // Redirect to a different page to prevent confirmation window
    header("Location: success.php");
    exit();
}
?>