Is it possible to prevent the POST array from being filled again when a page is refreshed?

When a page is refreshed, the POST array is filled again with the previously submitted form data. To prevent this, you can redirect the user to the same page using the GET method after processing the form data. This way, when the user refreshes the page, the form data will not be resubmitted.

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

    // Redirect to the same page using GET method
    header("Location: ".$_SERVER['PHP_SELF']);
    exit;
}
?>