Closed wilfi closed 9 years ago
Same problem here. Was _CAPTCHA supposed to be defined somewhere?
Your error reporting is setup to show notices. If you change it to ignore notices you'll be fine. Otherwise, feel free to submit a PR :)
To do that, you have to generate the image and send back the source. A very basic example:
<?php
// captcha.php
session_start();
include("simple-php-captcha.php");
$_SESSION['captcha'] = simple_php_captcha();
echo $_SESSION['captcha']['image_src'];
?>
Now apply the resulting value to an image. jQuery example for clarity:
$.get('captcha.php', null, function(response) {
$('#your-image-id').attr('src', response);
});
To verify the code, simply check against $_SESSION['captcha']['code']
when you submit the form. (Make sure to verify BEFORE calling simple_php_captcha()
again, otherwise the code will get regenerated!)
Im trying to load the image on ajax. The image is not loading and when I checked the log its showing as PHP Notice: Undefined index: _CAPTCHA Please help me out.