How can the issue of the PHP script immediately confirming the message when using "input type="image"" be resolved?

Issue: The problem arises when using "input type="image"" in a form, as it immediately confirms the message without allowing the user to review or edit it. To solve this, you can add a check to see if the form was submitted by the image input, and only process the message if it was submitted by a different input.

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if(isset($_POST['submit_button'])) {
        // Process the form data
        $message = $_POST['message'];
        // Further processing or validation
    }
}
?>

<form method="post" action="">
    <textarea name="message"></textarea>
    <input type="image" src="submit_button.png" name="submit_button">
</form>