Google reCaptcha联系表单集成

时间:2016-04-27 20:47:08

标签: php recaptcha

您好我的网站上有一个联系表单,我想将Google reCaptcha包含在内,我已经按照指南尝试集成它但是当我尝试在现场试运行时收到此错误消息形式。

  

致命错误:调用未定义函数getResponse()   第20行/home/guildina/public_html/contact-form.php

我的联系表格目前看起来像这样:

<?php

$to="contact@guildinator.com";

$subject="Message from the website";

$date=date_default_timezone_set("l, F jS, Y");
$time=date_default_timezone_set("h:i A");

$type=$_REQUEST['type'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$subject=$_REQUEST['subject'];
$message=$_REQUEST['message'];

$msg  = "";
$msg .= "Message sent from website on date:  $date, hour: $time.\n";
$msg .= "Email: $email\n";

if(grecaptcha.getResponse() == "")
    alert("You can't proceed!");
else
    alert("Thank you");

if($name == "" && $type == 'contact') {
    echo "<div class='alert alert-danger'>
        <a class='close' data-dismiss='alert'>×</a>
        <strong>Warning!</strong> Please fill the Name field.
    </div>";

} else if($email=="") {
    echo "<div class='alert alert-danger'>
        <a class='close' data-dismiss='alert'>×</a>
        <strong>Warning!</strong> Please fill the Email field.
    </div>";

} else if($message == "" && $type == 'contact') {
    echo "<div class='alert alert-danger'>
        <a class='close' data-dismiss='alert'>×</a>
        <strong>Warning!</strong> Please fill the Message field.
    </div>";

} else {
    mail($to,$subject,$msg,"From:".$email);
    echo "<div class='alert alert-success'>
        <a class='close' data-dismiss='alert'>×</a>
        <strong>Thank you!</strong>
    </div>";
}

?>

我对PHP知之甚少,很抱歉如果修改起来很简单。起初我想知道是不是因为我需要指定函数,但后来注意到我复制的代码上没有$符号。

提前感谢您提供任何帮助

0 个答案:

没有答案