Im working with a php form validation, which involves reCAPTCHA as well.
Once the form is submitted, I validate the form fields, and store the error messages like
if( !$this-> valid_username($username) ){
$this->error = "username is invalid <br />";
}
and similarly other fields.
Now, How can I access the $response->is_valid in my validation class so that I can display the captcha error sth like
if( !$response->is_valid ){
$this->error .= "Invalid captcha. <br />";
}
The idea is to display all fields errors at once.
I hope my question is clear, I’d appriciate any help.
I’m not exacly sure what you mean but I guess you need this:
http://code.google.com/intl/nl-NL/apis/recaptcha/docs/php.html
first include the usual reCAPTCHA library like this:
Then you can check the result like you mentioned above: