Trying to implement recaptcha on a contact for by request of the store owner. They are using the Luxe theme.
I've got recaptcha working, but looking for how I can keep the form values in place if no recaptcha response is returned. Right now, the form resets itself.
I've got the code on the page, and added the following to the contactForm.php. The form works, but when I return the msg if they haven't checked the captcha form, the form is blank. Any way to get the form to stay populated?
I am stuck!
Patty
$captcha;
if(isset($_POST['g-recaptcha-response']))
{
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha)
{
echo 'Please check the captcha form.';
exit;
}
/* Insert Your Secret Key Here - Not Your Site Key */
$secret = 'mykey';
$remoteip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$captcha. '&remoteip='.$remoteip);
if($response.success==true)
{ DO THE FORM STUFF }
I've got recaptcha working, but looking for how I can keep the form values in place if no recaptcha response is returned. Right now, the form resets itself.
I've got the code on the page, and added the following to the contactForm.php. The form works, but when I return the msg if they haven't checked the captcha form, the form is blank. Any way to get the form to stay populated?
I am stuck!
Patty
$captcha;
if(isset($_POST['g-recaptcha-response']))
{
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha)
{
echo 'Please check the captcha form.';
exit;
}
/* Insert Your Secret Key Here - Not Your Site Key */
$secret = 'mykey';
$remoteip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$captcha. '&remoteip='.$remoteip);
if($response.success==true)
{ DO THE FORM STUFF }
Comment