<?php if (empty($_POST['humanity']) || ($_POST['humanity'] != 'no_bot')) { die('Spam protection.'); } ?> <script> $('.custom-form').on('submit', function(event) { $(this).find('input[name=humanity]').val('no_bot'); }); </script>