How can PHP be used to differentiate between multiple image buttons in a form submission?

When using multiple image buttons in a form submission, PHP can differentiate between them by checking which button was clicked based on its name or value attribute. This can be done by checking the value of the specific button in the $_POST superglobal array.

if(isset($_POST['button1'])){
    // Code to handle button1 submission
}

if(isset($_POST['button2'])){
    // Code to handle button2 submission
}

// HTML form with multiple image buttons
<form method="post" action="">
    <input type="image" src="button1.png" name="button1" value="button1">
    <input type="image" src="button2.png" name="button2" value="button2">
</form>