'Which Captcha or related is easy to is install on form?

I am a newbie to programming and I already struggled a lot for a week to have a fully functional form that validates, stores data, and then redirects.

Please let me know about a captcha that is easy to install and doesn't mess up my code resulting in data not being sent to PHP which javascript did to me.



Solution 1:[1]

A very cheap way of doing a quick and dirty check could be something like this:

<form name="form" method="post">
  <!-- your other form fields -->
  <input type="text" id="title" name="title" value="somethingsomething">
  <input type="submit" value="send">
</form>

You can make the field invisible and choose a name, that a bot would definitely fill out. Choose anything meaningful just not something like "antispam" or the like.

input#title {
  visibility: hidden;
  height: 0;
  width: 0;
} 

And then just check if the input field got set:

<?php

if (isset($_POST["title"])) {
  // a bot had filled the field now, do something
}

?>

The concept is called "honeypot". You can also check out this stackoverflow post here:

Better Honeypot Implementation (Form Anti-Spam)

Solution 2:[2]

You can use the google cpatcha. You do not have to code at all

Procedure

1.Log on to your Google account.

2.Access https://www.google.com/recaptcha/adminInformation published on non-SAP site from your browser.

3.Select the Invisible reCAPTCHA radio button.

4.Register your domain.

Remember
Your domain is the URL of your Identity Authentication tenant. It has the <tenant ID>.accounts.ondemand.com pattern.

Tenant ID is automatically generated by the system. The first administrator created for the tenant receives an activation e-mail with a URL in it. This URL contains the tenant ID.

5.Save your Site key and your Secret key. You need them for the configuration steps in the administration console for Identity Authentication.

Source of answer

Solution 3:[3]

[Try this

  • The best CAPTCHA codes
  • No CAPTCHA reCAPTCHA
  • Image CAPTCHA
  • add a CAPTCHA to your website

][1] document :- url [1]: https://internet.com/website-building/how-to-add-a-captcha-to-your-website/

Solution 4:[4]

Try this:

  1. Register an hcaptcha account and follow it's instructions.
  2. Add <script src="https://hcaptcha.com/1/api.js" async defer></script> to your head if you have not already done so
  3. Add <div class="h-captcha" id="captcha" data-sitekey="INSERT SITEKEY HERE" data-theme="dark"></div> (Leave data-theme="dark" in for dark theme).
  4. In your form tag, add onsubmit="return checkCaptcha()" as an attribute, like so: <form onsubmit="return checkCaptcha()">
  5. Add the function below to your JS code:
function checkCaptcha() {
    if (hcaptcha.getResponse() == "") {
          return false;
    } else {
          return true;  
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Navan K.
Solution 3 Kavindu Chathuranga
Solution 4 Duncan Leung