I have multiple reCAPTCHAS on the same page, and all reCAPTCHAS return $_POST['g-recaptcha-response']
by default. Is there a way so that I can change the $_POST name for each Recaptcha, and therefore access the individual responses of them?
If my site keys / secret keys are the same, will this mean that I can't access the individual responses?
Thanks for the help! :)
HTML:
<div class="g-recaptcha" id="recaptcha1"></div>
<div class="g-recaptcha" id="recaptcha2"></div>
jQuery:
var recaptcha1 = $("#recaptcha1");
var recaptcha2 = $("#recaptcha2");
var myCallBack = function() {
//Render the recaptcha1 on the element with ID "recaptcha1"
recaptcha1 = grecaptcha.render('recaptcha1', {
'sitekey' : 'removed_for_demonstration',
'theme' : 'light'
});
//Render the recaptcha2 on the element with ID "recaptcha2"
recaptcha2 = grecaptcha.render('recaptcha2', {
'sitekey' : 'removed_for_demonstration',
'theme' : 'light'
});
};
PHP:
$captcha = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : "";