0

i have made a contact us form that emails to my email,, but the problem is that i made a text field to avoid spam machines, which says 1+1= ? , and the answer in the input field must be always 2

if(isset($guess) == "2"){
		die("Please Enter all the fields correctly");
		}

but it didnt work i tried also != ,,
can anyone write me his own code ,,please please help !!

5
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by diafol
0

Can you please provide the entire code you are using so that it will be helpful to detect where the problem lies...

Thanks!

0

have a html form for users to enter the answer:

form method=post action=abc.php
input type="text" name="answer"
input type="submit" value="submit"
/form

Then, use php to obtain the value entered in field:


$value=$_POST;

if($value!=2){
echo "sorry!! Answer wrong!!";
}

0

it would be

<?php
if($_POST['guess'] != 2) {
die("Answer is rong");
} else {
 what happens if right
}
?>
0

This is wrong:

if(isset($guess) == "2"){

You're trying to test and check its existence in one go - do this:

if(isset($guess) && $guess == "2"){
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.