gpt4 book ai didi

php - 联系表单脚本未运行,白页

转载 作者:行者123 更新时间:2023-11-27 23:52:00 26 4
gpt4 key购买 nike

尝试提交包含以下条目的联系表单时出现白屏:- 姓名- 电子邮件- 主题- 消息

我正在尝试通过我的网站接收电子邮件。我检查了所有变量名称等,似乎一切都是正确的。我是 PHP 的新手,所以我对接下来要尝试的事情有点不清楚。谢谢

<form method"POST" action="action/form-submit.php"> <!--NO FOR ATTRIBUTE, NOT ADDING FUNCTIONALITY-->
<h2>Contact Me:</h2>
<label>Your Name:</label>
<input name="name" type="text" placeholder="Your Name..." required/>
<label>Email:</label>
<input name="email" type="email" placeholder="Email..." required/>
<label>Query Type:</label>
<select id="qry" name="query" required>
<option value="" disabled selected>Please Select:</option>
<option value="jobs">Jobs</option>
<option value="website">Website Issues</option>
<option value="info">Information</option>
</select>
<label>Your Message:</label>
<textarea name="info" placeholder="Your Message..." required></textarea>
<input type="submit" value="Submit">
</form>

然后是PHP代码:

<?php
$vname = $_POST['name'];
$vemail = $_POST['email'];
$vquery = $_POST['query'];
$vmessage = $_POST['info'];

$email_from = "test@gmail.com";

$email_subject = "New Website Submission";

$email_body = "Visitor Name: $vname.\n".
"Visitor Email: $vemail.\n".
"Visitor Subject: $vquery.\n".
"Visitor Message: $vmessage.\n";

$to = "bradleyarcher98@gmail.com";

$headers = "From: $email_from \r\n";

$headers .= "Reply-To: $vemail \r\n";

mail($to,$email_subject,$email_body,$headers);

header("location: contact.html");

?>

最佳答案

为了查看错误,您需要打开 PHP 错误处理。

启用此功能后,您将不再只是看到一个白页,而是会向浏览器发送一条包含文件名、行号和描述错误的消息的错误消息。

关于php - 联系表单脚本未运行,白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56467148/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com