I have simple code in PHP and trying to check my form with reCaptcha.
I already tried v3 or v2 and the problem is the same.
All links are correct, I have no table in form, and keys from console admin are right.
Is there any solution to how I can fix it and have reCaptcha n my form?
MY CODE:
<form method="POST" action="_inc/calc.php">
<div class="form-field">
<textarea name="FormMessage" id="message" rows="5"></textarea>
<label for="message">Správa</label>
</div>
<?php
require_once('_inc/recaptchalib.php');
$publickey = "xxx"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<button type="submit" class="btn btn__main">
Odoslať
</button>
</form>
calc.php
<?php
$privatekey = "xxx";
require_once('recaptchalib.php');
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
require 'mail-sender.php';
require 'adminmail-sender.php';
header("Location: https://aptcare.sk/dakujeme");
}
How can I