Then I have a simple <input type=“text” where a visitor can simply add the value of $firstnumb to the value of $secondnumb enter the numerical answer a textbox named “entry1”.
Now I need to compare the value of entry1 to the value of $entry.
If the values compare, then I would like to process the action described in the form element:
There are millions of ways to make sure it is not a robot.
One super simple way is to just have an input field with a set value like this:
Then, when posted, just check for if(!isset($_POST["robot"]))
If the entry for "robot" exists, it was not a human. If does not exist, continue processing.
Now, you can do it your way. Easy enough. One thing you must understand is that PHP is server-side only and user entries are client-side only. So, you can NOT use Javascript to handle this because any beginner programmer can alter the values. If you wanted to do it in your version, loosely do it this way. Not tested!
for the html:
If( $_POST["number3]!=$_POST["number1"] + $_POST["number2"] ) {
// User did not enter correct value, display an error...
} else {
// User entered correct data, process rest of data here...
}
Not test, but, something like this should work for you. Remember == is the test if equal, != is not-equal
Good luck !