How effective is using a dynamic name for the submit button in PHP forms to prevent automated submissions?

Using a dynamic name for the submit button in PHP forms can be effective in preventing automated submissions because it creates a unique identifier for each form submission. This unique identifier can then be validated on the server side to ensure that the form was submitted by a real user and not a bot.

<?php
// Generate a dynamic name for the submit button
$submit_name = 'submit_' . uniqid();

// Add the dynamic name to the form
echo '<form method="post">';
echo '<input type="text" name="name" placeholder="Name">';
echo '<input type="email" name="email" placeholder="Email">';
echo '<input type="submit" name="' . $submit_name . '" value="Submit">';
echo '</form>';

// Validate the form submission
if(isset($_POST[$submit_name])) {
    // Process the form data
    $name = $_POST['name'];
    $email = $_POST['email'];
    // Additional validation and processing logic here
}
?>