This question has been asked before: New Google ReCaptcha not posting/receiving 'g-recaptcha-response' - but there was no proper answer.
I have the exact same set up as him, but the code fails here:
if(!$captcha){ exit; }
so $captcha=$_POST['g-recaptcha-response']
seems to be empty.
new google recaptcha with checkbox server side php = The 2nd answer here also doesn't seem to work.
Does anyone know why this could happen?
I encountered this issue and found that my form was closing prematurely in the DOM because it was inside a table. ReCaptcha sets up a display:none g-recaptcha-response textarea and later fills in the data when you complete the captcha. It seems to look for children of the form that the div is in and thus couldn't find the g-recaptcha-response it had initially created. I put the form around the table and it worked fine after that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With