Hello Group,
I just came across this Notice when trying to implement reCAPTCHA and
saw some posts about it here so I figured I would post the code that I
used to get it to work, in case it will help anyone else.
-----------------------------------------------------------------
// THIS CODE SHOWS NOTICE MESSAGE
if ($_POST['recaptcha_response_field']) {
$response = recaptcha_check_answer(
$privatekey, $_SERVER['REMOTE_ADDR'],
$_POST['recaptcha_challenge_field'],
$_POST['recaptcha_response_field']
);
// THIS CODE DOES NOT SHOW NOTICE MESSAGE
if (isset($_POST['recaptcha_response_field'])) {
$response = recaptcha_check_answer(
$privatekey, $_SERVER['REMOTE_ADDR'],
$_POST['recaptcha_challenge_field'],
$_POST['recaptcha_response_field']
);
-----------------------------------------------------------------
1) if ($_POST['recaptcha_response_field']) tests if the field is
equal to 1 (true).
2) if (isset($_POST['recaptcha_response_field'])) tests if the
field has been set (defined).
I believe you would only use 1) as an IF condition if you expect the
condition to be TRUE or FALSE. Whereas 2) tests whether the variable
has been set, which is what you actually want to test, because if it's
set this means the form has been submitted and if it's not set
(undefined) then you want to display the reCAPTCHA.
Scott Shemtov
http://www.shorewebmaster.com/