Are there any best practices for handling form submission with image buttons in PHP?

When handling form submissions with image buttons in PHP, it is important to check for the presence of the image button input field in the $_POST array to determine if the form was submitted using the image button. This can be done by checking if the key associated with the image button input field exists in the $_POST array.

if(isset($_POST['image_button_name_x']) && isset($_POST['image_button_name_y'])) {
    // Form was submitted using the image button
    // Handle the form submission here
} else {
    // Form was not submitted using the image button
    // Handle the form submission in the regular way
}