<input id="check" name="check" type="hidden" value="" />
onclick="document.getElementById('check').value = 'secretcode';"
<button onclick="document.getElementById('check').value = 'secretcode';" type="submit">Отправить</button>
if ($_POST['check'] != 'secretcode') exit('Spam decected');