0
我有一些麻煩設置recaptha與我有限的PHP知識。我設法從根本上解決了這個問題,但是我發現知道我的表單數據沒有提交。PHP表格數據沒有提交與recaptcha
這裏是PHP,因爲它主張:
<?php
$sendToEmail="[email protected]";
$yourname = $_POST["yourname"];
$timecall = $_POST["timecall"];
$email=$_POST["email"];
$phone=$_POST["phone"];
$message=$_POST["message"];
$content = "Time to Call : " . $timecall . "<br>";
$content .= "Name : " . $yourname . "<br>";
$content .= "Email : " . $email . "<br>";
$content .= "Phone : " . $phone . "<br>";
$content .= "Message : ". $message ."<br>";
$senderEmailId = "Reply-To: $email";
$senderEmailId = "From: $email\r\n";
$senderEmailId .= "Content-type: text/html\r\n";
$subject ="New Enquiry from the website";
if(isset($_POST['ContactButton'])) {
$url = 'https://www.google.com/recaptcha/api/siteverify';
$privatekey = "--private-key--";
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST[g-recaptcha-response]."&remoteip=".$_SERVER['REMOTE_ADDR']);
$data = json_decode($response);
if (isset($data->success) AND $data->success==true) {
//// True- what happens when user is verified
header("Location:thankyou.php?CaptchaPass=True");
}else{
header("Location:thankyou.php?CaptchaFail=True");
}
}
?>
預先感謝您!