What are some best practices for handling page reloads after user actions in PHP applications?

When handling page reloads after user actions in PHP applications, it is best practice to use the Post/Redirect/Get (PRG) pattern. This pattern involves processing form submissions, performing any necessary actions, and then redirecting the user to a different URL to prevent form resubmission on page reloads.

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

    // Redirect user to a different URL
    header("Location: success.php");
    exit;
}