What is the potential issue with using GET method to write data to a database in PHP?

Using the GET method to write data to a database in PHP can expose sensitive information in the URL, making it vulnerable to security risks such as SQL injection attacks. To solve this issue, it is recommended to use the POST method instead, as it keeps data hidden from the URL and is more secure for handling sensitive information.

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Process form data and write to database
}