What are the potential pitfalls of using a header redirection in PHP for form submissions?

One potential pitfall of using a header redirection in PHP for form submissions is that it can cause issues with form resubmission when users refresh the page. To solve this issue, you can use the Post/Redirect/Get (PRG) pattern, where after processing the form data, you redirect the user to a different page using a GET request to prevent form resubmission.

// Process form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Process form data

    // Redirect user using GET request
    header("Location: success.php");
    exit();
}