phphelp01 Posted December 23, 2008 Share Posted December 23, 2008 I wanted to create a simple math question but not the real captcha. It is like a simple question of 2 + 2 = ? and have validation of if the answer is 4. How do I do the validation of if 4 let them submit if the answer is wrong give an error message below the input box? Thanks. Link to comment https://forums.phpfreaks.com/topic/138113-captcha-like-math/ Share on other sites More sharing options...
9three Posted December 23, 2008 Share Posted December 23, 2008 I'm assuming you are allowing the user to input whatever two integers they want: <?php $field1 = 'integer1'; // first HTML Field name $field2 = 'integer2'; // Second HTML Field name if($field1 && $field2 == 4) { echo 'Correct Answer'; } else { echo 'Sorry incorrect answer'; echo <<<HTML <table width="200" padding="0" margin="0"> <tr> <td>YOUR UPLOAD FORM HERE</td> </tr> </table> HTML; } ?> Link to comment https://forums.phpfreaks.com/topic/138113-captcha-like-math/#findComment-722010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.