How can the value of an image submit button in a PHP form be properly transmitted without getting coordinates instead?

When using an image submit button in a PHP form, the default behavior is to send the coordinates of where the button was clicked instead of the actual value of the button. To properly transmit the value of the image submit button, you can use a hidden input field to store the value and then retrieve it in the PHP script when the form is submitted.

<form method="post" action="submit.php">
  <input type="hidden" name="image_submit" value="">
  <input type="image" src="submit.png" name="submit_button">
</form>

// submit.php
$image_submit = $_POST['image_submit'];
if(isset($_POST['submit_button'])) {
  $image_submit = $_POST['submit_button'];
}