Prevent php web contact form spam

前端 未结 7 2124
面向向阳花
面向向阳花 2021-01-30 14:14

I am an amateur web designer, I have searched on stackoverflow.com and other websites and have found many fixes for this issue I\'m having, but none of them have worked (probabl

7条回答
  •  孤城傲影
    2021-01-30 14:45

    A simple trick is to create a honeypot field:

    html

    
    
    

    css

    /*in your css hide the field so real users cant fill it in*/
    form #website{ display:none; }
    

    php

    //in your php ignore any submissions that inlcude this field
    if(!empty($_POST['website'])) die();
    

提交回复
热议问题