reCAPTCHA v3 work with a same .php for view html and valid form?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10039248
    hidroxid
    Participant

    Hello there

    I have built my forms using the “Contact-form Basic”.

    The same .php file elaborates the html to be displayed and when it receives the $ _POST with the submit button, it proceeds to carry out the validations and send the mail. All work like a charm.

    The question:

    This way in which I have built my forms does not allow the correct incorporation of reCAPTCHA v3?

    I ask because in your examples, you have the html code in a file (.html) and the validation code.

    I try to add the extra code for use the reCAPTCHA and have errors, seem to be related to the headers when i get the return from the code .js in contact-form.

    I only need to know that there is no problem with this way of forms (one .php) or when use reCAPTCHA is necessary use separated files and have to change my structure of forms.

    Thanks.


    #10039269
    Support
    Keymaster

    Hello,

    At really the “Contact Us – Basic” and the “Contact Us – Recaptcha (v3)” are very similar. We just need some changes in the HTML and PHP.

    1) First change the <form> tag to:

    <form class="contact-form-recaptcha-v3" action="php/contact-form-recaptcha-v3.php" method="POST">.........</form>

    2) Add the below script on footer of page:

    <script id="google-recaptcha-v3" src="https://www.google.com/recaptcha/api.js?render=YOUR_RECAPTCHA_V3_SITE_KEY_GOES_HERE"></script>

    3) Make sure you have the script view.contact.js included on footer of the page.

    4) Open the php/contact-form-recaptcha-v3.php and change the variable $secret with your Google Recaptcha V3 Secret Key. Also, change the variable $email to define which email should receive the contacts. You can compare your current PHP code with the php/contact-form-recaptcha-v3.php, you will see that’s very similar.

    In resume, to get the recaptcha V3 working you need the mentioned changes in the HTML and use the php/contact-form-recaptcha-v3.php. Ah, and make sure to have the view.contact.js script included on footer of the page.

    Please try that and let us know if you need further assistance.

    Kind Regards,

    Okler Themes.


    If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads


Viewing 2 posts - 1 through 2 (of 2 total)

This topic is marked as "RESOLVED" and can not rceive new replies.