What are the potential security risks associated with using GET requests for deleting data in PHP?

Using GET requests for deleting data in PHP can pose security risks as the data being deleted is exposed in the URL, making it vulnerable to attacks such as CSRF and unauthorized access. To mitigate this risk, it is recommended to use POST requests for deleting data as they are more secure and not visible in the URL.

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Delete data securely
} else {
    // Redirect or display an error message
}