I am trying to add reCaptcha v2 to an HTML form. When the submit button is clicked, a PHP file is invoked which calls the reCaptcha API.
If the reCaptcha is unsuccessful, I want to call the alert function inside the HTML page from the PHP file.
I have researched a lot but I couldn't find anything for my use case. This post shows how to show alert inside PHP not inside an HTML file.
Right now when I click submit without doing reCaptcha, I've encountered a blank PHP page, but I expect to remain in the HTML form without deleting the form content and show an alert message asking the user to complete reCaptcha.
Thanks in advance!