我试图添加验证码到我的网站,我试图让感谢你在不同的页面打开,而不是使用php在同一文件中,我怎么去做这个?
我知道这是php周围的形式的部分,但我不知道如何改变它发送到一个单独的感谢页面。
EDIT -如果我添加一个操作页面captcha中断,但表单提交,当我采取的行动,captcha工作,但不提交
<!DOCTYPE html>
<?php
// grab recaptcha library
require_once "recaptchalib.php";
// your secret key
$secret = "MY SECRET KEY";
// empty response
$response = null;
// check secret key
$reCaptcha = new ReCaptcha($secret);
// if submitted check response
if ($_POST["g-recaptcha-response"]) {
$response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
?>
<html lang="en">
<head>
<!--js-->
<script src='https://www.google.com/recaptcha/api.js'></script>
<title>MATA captcha test</title>
</head>
<body>
<?php
if ($response != null && $response->success) {
echo "Hi " . $_POST["name"] . " (" . $_POST["email"] . "), thanks for submitting the form!";
} else {
?>
<form action="" method="post">
<label for="name">Name:</label>
<input name="name" required><br />
<label for="email">Email:</label>
<input name="email" type="email" required><br />
<div class="g-recaptcha" data-sitekey="MY KEY"></div>
<input type="submit" value="Submit" />
</form>
<?php } ?>
</body>
</html>
你是这个意思吗?
<form action="insert_your_site_here.php" method="post">
代替
<form action="" method="post">