What best practices should be followed when handling multiple form submissions with different actions in PHP?

When handling multiple form submissions with different actions in PHP, it is best practice to use conditional statements to determine which action to take based on the submitted form data. This can be achieved by checking the value of a hidden input field or a specific button name in the form. By using conditional statements, you can execute the appropriate code block for each form action.

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST['action1'])) {
        // Handle form submission for action 1
    } elseif (isset($_POST['action2'])) {
        // Handle form submission for action 2
    } else {
        // Handle default form submission
    }
}