Hi all,
I wonder if anyone could help me out; I have a PHP form that need to put a secure image to prevent spam.
I have use this code provided in this page http://www.phpcaptcha.org/ - It works fine but the problem was when user entered an incorrect code it form still proceed which it not right.
My form involved some PHP and Javascript to handle the error messages - I wonder if I need AJAX script for this as well?
I use this Javascript to validate if the form has been enter blank or not:
..
..
$('[name=captcha_code]').parent().removeClass('error');
if($('[name=captcha_code]').val()==""){
error_num++;
error_mesg += "Please enter the image verification\n";
$('[name=captcha_code]').parent().addClass('error');
}
..
..
And I need to put this code for matching code to verify if the code incorrect or correct. If incorrect a error message will display together.
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// you should handle the error so that the form processor doesn't continue
// or you can use the following code if there is no validation or you do not know how
echo "The security code entered was incorrect.<br /><br />";
//echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
//exit;
}
Can someone please assist me about this.
Thanks in advance.