18 Mar, 2018

How to create contact form in php using google recaptcha

18 Mar, 2018

Dear Reader, let us know that, “How to create a contact form in PHP using google recaptcha“. So in this Tutorial, We Learn Step By Step “How to create a contact form in PHP using google recaptcha Process”.

The reCAPTCHA PHP Library provides a simple way to place a CAPTCHA on your PHP website. So, reCAPTCHA will protect your website from spam with the better user experience.Using reCAPTCHA users can prove they are human without solving a CAPTCHA. They need just a single click to confirm they are not a robot.

First, we see Snapshot for Contact Us form


And you can also see Live “Demo” by click on below Demo button

Step 1:-  At First, we need to Register our website and get “reCAPTCHA” Key by click here

Step 2:-  In Registration form of the website we need to Fill the below details

i) Label

ii) Choose the type of reCAPTCHA


as we can see in below snapshot after fill details click on “Register” Button



Step 3:- After Registration, we see “Site Key” and “Secret Key” as we can see in below snapshot


Step 4:-  At First, We need to Create Database to Contact Details in the database for future use, So let’s create a database like “php_test”

Step 5:-  After Creation of database copy below SQL code and run SQL Query.

Step 6:- Now we need to Create “config.php” file for Database Configuraion in our project’s root directory like “htdocs/webpreprations/demo/contact-form-in-php-using-google-recaptcha/config.php”  and paste below code

Step 7:- Now we need to Create “index.php” file in our project’s root directory like “htdocs/webpreprations/demo/contact-form-in-php-using-google-recaptcha/index.php”  and paste below code

Step 8:- After Creation of “index.php” file we need to change our “site key” as we can see in below snapshot


Step 9:- Now run your project, so you need to type in browser localhost/your_project_name/index.php like

http://localhost/webpreprations/demo/contact-form-in-php-using-google-recaptcha/index.php then you can see the result as in below snapshot


Congratulations you have successfully Completed “How to create a contact form in PHP using google recaptcha Process“, if you like this post and was helpful for you then share this post on social media and if you have any query then please contact us or comment below, Thanks.

Related Articles


  • Rukhsad September 27, 2018

    Very interesting tutorial, I love that
    Keep it up, All the best 🙂


    • Webpreparations Team September 28, 2018

      Thank you so much dear Reader.


Leave a comment:

Leave a Reply to Webpreparations Team Cancel reply

Your email address will not be published. Required fields are marked *