Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7559757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:43:01+00:00 2026-05-30T12:43:01+00:00

I am creating a jquery ajax popup comment form, but am having a problem

  • 0

I am creating a jquery ajax popup comment form, but am having a problem with the way Im setting up my “honeypot” in php.

The honeypot ($robotest) isn’t working; instead the script returns “E-mail is not correct”. Can anyone point out my error? Thank you

The html form is:

<form class="cmxform" id="commentForm" method="POST" action="">
   <p>
     <label for="cname">Name</label>
     <input id="cname" name="name" size="25" class="required" minlength="2" />
   </p>
   <p>
     <label for="cemail">E-Mail</label>
     <input id="cemail" name="email" size="25"  class="required email" />
   </p>
   <p>
     <label for="curl">URL</label>
     <input id="curl" name="url" size="25"  class="url" value="" />
   </p>
   <p>
     <label for="ccomment">Your comment</label>
     <textarea id="ccomment" name="comment" cols="22"  class="required"></textarea>
   </p>
    <p class="robotic" id="pot">
        <label>Please leave this blank:</label>
        <input name="robotest" type="text" id="robotest" class="robotest" />
    </p>
   <p>
     <input class="submit" type="submit" value="Submit"/>
   </p>

EDIT:

Thanks to @JamWaffles for the support. Below is the correct way to implement the honeypot. (And as Kamalo noted you will want to have the id of ‘robotest’ set to display:none in your css):

<?php
$robotest = $_POST['robotest'];
$email = $_POST['email'];   
if((!filter_var($email, FILTER_VALIDATE_EMAIL)) && ($robotest == "")) { 
    print "E-mail is correct";      
    $to      = 'asdfdsafasdfsda@gmail.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com';       
    mail($to, $subject, $message, $headers);        
} else {
    print "E-mail is not correct";
}   
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:43:03+00:00Added an answer on May 30, 2026 at 12:43 pm

    filter_var() returns a non-falsy value when the email is valid, not false. Remove the ! before filter_var( in your if():

    if((filter_var($email, FILTER_VALIDATE_EMAIL)) && ($robotest = "")) 
    

    You’re executing code inside the if() when filter_var() fails, which is why you’re getting

    E-mail is not correct

    for valid emails.


    Something else I missed too is the fact you’re assigning to $robotest instead of comparing it against an empty string. You need to use the double equals comparison operator instead of the single equals assignment operator. Your if() should look like this:

    if((filter_var($email, FILTER_VALIDATE_EMAIL)) && ($robotest == "")) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a registration form using PHP and jquery with ajax. Each field
I'm reading a tutorial about creating a shoutbox with jquery, php and ajax. In
I am creating an jquery ajax form which calls the method below public string
I am creating a comment form based on the jquery validation plugin ( http://docs.jquery.com/Plugins/Validation
I am having trouble getting jQuery ajax to recognise a session. I am creating
I'm creating a CMS using jQuery and AJAX. When I click, my Add Campaign
I am creating a web app which uses jQuery to authenticate: $.ajax({ url: /session/create?format=json,
i am dynamically creating radio using jquery as shown belown. but they value only
I have jQuery.ajax() creating a request to a url (cms2/docman/dir/%id) (%id is a numeric
On the success function of jquery ajax request i am creating div with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.