Prevent Spam Form Submissions By Bots In PHP

In this quick php tutorial i will explain prevent spam form submission using honeybot php form. I am not going to use any third party library rather i will use honeypot spam prevention technique.

Quoting the definition from Wikipedia,


In computer terminology, a honeypot is a computer security mechanism set to detect, deflect, or, in some manner, counteract attempts at unauthorized use of information systems.


So in this example you will learn prevent form spam without captcha in php. So let's see the example code of php form spam prevention.


In the backend, you can verify it like below

if (isset($_POST)) {

    if (!empty($_POST['dont_fill_this'])) {
        // this is bot submission

    // continue with handling the 
    // rest of the form submission


Read also : Don't use if else ladder in php rather use this method


Hope it can help you.