dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Bots spam my form mail. How can I require an e-mail address for a submission?

  1. #1
    Join Date
    Sep 2008
    Posts
    29

    Question Bots spam my form mail. How can I require an e-mail address for a submission?

    Hello all:
    Bots have very recently begun relentlessly spamming my simple htmp form mail page. I'm getting over a hundred spammed submissions per day now, albeit with no e-mail addresses offered by such pesky spambots.

    Use of CAPTCHA-like services for filtering purposes concerns me though, since I've seen them screen out my own legitimate submissions elsewhere in the past.

    Is there any html coding I can use, though, to require the submission of an "@" containing e-mail address in a particular one of the form's individual boxes? I require an e-mail address for a submission and humans very seldom have a problem complying.

    Any suggestions, please?

    As a sidenote, if there's a way to make it so that the form won't erase all inserted contents if one mistakenly forgets to insert an "@" symbol, then that would help as well.

    Thanks in advance :-)

  2. #2
    Join Date
    Mar 2012
    Posts
    1,813
    It is very easy in PHP or JavaScript to block submission of the form if an email address is not given, or is not correctly formatted. I do not understand your problem. E.g. This PHP fragment:

    elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $prefix=" email ";
    $status="invalid";}

  3. #3
    Join Date
    Sep 2008
    Posts
    29
    Thanks for the interesting reply. I wonder if such a PHP fragment could successfully work if inserted somewhere in what's seemingly just an html e-mail submission form. Regarding the html that I can see, the following is included:


    <INPUT TYPE="submit" VALUE="Send">

    Perhaps the rest is stored on the server with the hosting company. I wonder if that affects your analysis? Either way, I greatly appreciate your feedback.

  4. #4
    Join Date
    Mar 2012
    Posts
    1,813
    The <input> tag is not the problem. The important info is in the <form> tag at the beginning of the form. Unless it uses JavaScript, this should say something like:

    <form action="xxx" method=post>

    The "xxx" is the url of the script used to process the form input. That is where the PHP fragment (or similar) goes. By the way, one way to stop the form being cleared when it is submitted is to embed the PHP script in the page containing the form. See http://www.emberwebsites.co.uk/Contact.php. This uses just html/php processing of the email, with no JavaScript or libraries. It may be a little difficult to follow at first, but everything you should need is there.
    Last edited by jedaisoul; 10-22-2012 at 06:46 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles