How can the isset() function be used to determine which button was pressed in a form submission?

When a form is submitted with multiple buttons, you can use the isset() function in PHP to determine which button was pressed. This is done by checking if the specific button's name is set in the $_POST array. By using this method, you can execute different actions based on which button was clicked.

if(isset($_POST['button1'])){
    // Code to execute when button1 is pressed
} elseif(isset($_POST['button2'])){
    // Code to execute when button2 is pressed
} else {
    // Code to execute if no button is pressed
}