This is a demo of the honeypot method, as described in our article on how to prevent spam. The front end is exactly the same, and here's the PHP code:
<?php

    if(isset($_POST['url']) && $_POST['url'] == ''){      
            
        echo "You didn't fill in the honeypot field!";
              
        } else{
            
        echo "You were warned.";
              
    }
            
?>