What are some potential security risks associated with passing parameters in a PHP script via GET instead of POST?

Passing parameters in a PHP script via GET exposes the data in the URL, making it visible to users and potentially being intercepted by malicious third parties. This can lead to security risks such as data tampering, injection attacks, and sensitive information exposure. To mitigate these risks, it is recommended to use POST method for passing sensitive data in PHP scripts.

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Process the form data securely
} else {
    // Redirect to a secure page if accessed via GET method
    header("Location: https://www.example.com/secure-page.php");
    exit();
}
?>