What are the potential pitfalls of relying on the automatic submission of button names in PHP forms?

One potential pitfall of relying on the automatic submission of button names in PHP forms is that it can be easily manipulated by malicious users to submit the form with unintended actions. To solve this issue, you can add server-side validation to check if the button name matches the expected value before processing the form submission.

if(isset($_POST['submit_button']) && $_POST['submit_button'] === 'confirm') {
    // Process form submission
} else {
    // Handle incorrect button submission
}