Hello Shamim,
Can you please make a short video on how to add to custom PHP code?
Currently, I can show the captcha, but I’m not sure how to verify.
Thanks
Hi Shamim, i am trying to do the same thing, and your linked page above helped. Would this be correct?
<form action="somewhere.php" method="POST">
<input id="first_name" maxlength="40" name="first_name" size="20" type="text" required="">
<?php do_action('anr_captcha_form_field');?>
<?php
if ( anr_verify_captcha() ) {
// Answer is right
// process form
} else {
// Answer is wrong
// Show error or take other necessary action
// Do not process form
event.preventDefault();
alert("Please check the recaptcha");
}
?>
<input type="submit" name="submit">
</form>
So, is anr_verify_captcha()
in a good place or does it even matter?
Thanks!
-
This reply was modified 5 years, 7 months ago by
benjaminblue.
-
This reply was modified 5 years, 7 months ago by
benjaminblue. Reason: fixed error
accidental second message.
-
This reply was modified 5 years, 7 months ago by
benjaminblue.
-
This reply was modified 5 years, 7 months ago by
benjaminblue.
anr_verify_captcha()
will be in your validate function. in your case in somewhere.php
Suppose when someone submit this form you send an email to admin with this form content. anr_verify_captcha()
will be there before email sent. So if this function return false then you will not send email to admin. Instead you will show error to that user so that they get another chance to solve captcha.
Thank you for the quick reply!
I totally understand, and my issue is, I am working on a form previously coded by another dev, and it posts to somewhere else – my somewhere.php is actually an external .asp that I cannot change nor do I have access to.
Any ideas on somehow working around that?
In that case i believe it will be better for you to hire any developer. They can investigate more closely and write code for you.