What are the best practices for handling multiple submit buttons in a PHP form?

When handling multiple submit buttons in a PHP form, it is important to differentiate between the buttons and perform different actions based on which button is clicked. This can be achieved by checking the value of the submit button in the form submission handling code and executing the corresponding logic.

<?php
if(isset($_POST['submit_button1'])){
    // Logic for handling submit_button1
} elseif(isset($_POST['submit_button2'])){
    // Logic for handling submit_button2
} else {
    // Default logic if no submit button is clicked
}
?>