Hello all,
I have a problem to validate my secureimage (CAPTCHA). Basically I have 3 pages of forms (formCheck.php, processForm.php and thankyou.php) - I have place this script in processForm.php -- This page only will display if the code was incorrect entered.
<?php
session_start();
require("include/application_top.php");
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
echo "The security code entered was incorrect.<br /><br />";
//exit;
//}
?>
The problem is: most of my error checking is in the first page (formCheck.php) which I'm using Javascript (Pop Up error messages) - And I would like the same goes to the CAPTCHA validate error message if someone entered a wrong code and will display and pop up on the first page as well. I heard that I need to use AJAX to build this? But I don't know how AJAX works. Can anyone please assist me?
This is one of my example of error msg which I place in formCheck.php:
This snippets will displayed if field is empty
$('[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');
}
This snippets (not working but this is what I want to achieve) will displayed if code entered is not match the code...
$('[name=captcha_code]').parent().removeClass('error');
if ($securimage->check($_POST['captcha_code']) == false){
error_num++;
error_mesg += " The security code entered was incorrect \n";
$('[name=captcha_code]').parent().addClass('error');
}
Anyone please?