We have a live reCaptcha v2 implementation at the following URL:
https://och.stonybrook.edu/index.php?page=roommates&task=submit
The reCaptcha has been working fine until reported to me as not working today.
I have identified the following:
- The reCaptcha JS is loading successfully
- The reCaptcha is working well on the form -- creating the element, checking the box and adding an encrypted string to the g-recaptcha-response textarea element that is created by the library.
- However, on the server I am seeing no value for $_POST['g-recaptcha-response']
- When I var_dump the $_POST array in PHP, I see all other form values but not this one. It does not exist as an index in the $_POST array
I have:
- Verified domain in reCAPTCHA admin
- Created a new site/secret key pair
- Tried the test key pair provided by Google via the docs
I can't get to the bottom of why that <textarea>
is not posting its data to the server.
I have crawled the docs at https://developers.google.com/recaptcha/docs/verify to no avail.
HTML:
<!-- Using the Auto Render implementation as described in
https://developers.google.com/recaptcha/docs/display#auto_render -->
<!-- in <head> -->
<script src="https://www.google.com/recaptcha/api.js"></script>
<!-- in <form> -->
<div class="g-recaptcha" data-sitekey="SITE_KEY"></div>
PHP:
echo($_POST['g-recaptcha-response']); //outputs nothing
var_dump($_POST); //outputs all of my form values, except for <textarea id="g-recaptcha-response">