联系表单中的一些变量问题

时间:2017-04-09 08:03:07

标签: php forms

我正在尝试使用我在管理面板上设置的变量来设置我的联系表格。变量工作得很好,因为我在其他文件中使用它们但我不能使它们在联系表单中起作用我不知道它们是否正确定义或者我称它们是错误的。我在等你的帮助,我是页面的新手,谢谢你。

PD:如果我手动输入值,表单就可以正常工作,例如,如果在$ from中我将$ from ='';因为它没有问题,但变量号为

include "inc/database.php";

$result = mysqli_query($con, "SELECT * FROM `settings` LIMIT 1") or die(mysqli_error($con));
while($row = mysqli_fetch_assoc($result)){
    $contactemail = $row['contactemail'];
    $adminemail = $row['adminemail'];
    $secretkey = $row['secretkey'];
    $website = $row['website'];

}
// require ReCaptcha class
require('recaptcha-master/src/autoload.php');

// configure
$from = ''.$row['website'].' <'.$row['contactemail'].'>';
$sendTo = '<'.$row['adminemail'].'>';
$subject = 'New message from '.$row['website'].'';
$fields = array('name' => 'Name', 'surname' => 'Lastname', 'email' => 'Email', 'message' => 'Message'); // array variable name => Text to appear in the email
$okMessage = 'Contact form successfully submitted. Thank you, I will get back to you soon!';
$errorMessage = 'There was an error while submitting the form. Please try again later';
$recaptchaSecret = ''.$row['secretkey'].'';

0 个答案:

没有答案