alert();
我正在使用 reCAPTCHA,如果 CATPCHA 被错误地填写为而不是加载新页面,我想显示响应。我怎样才能做到这一点?
这是表单操作:
<form id="form" method="POST" action="verify.php">
在 verify.php 文件中使用这个:
<?php
require_once('recaptchalib.php');
$privatekey = "(my key)";
$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 {
// Your code here to handle a successful verification
}
?>