1 回答
TA贡献1816条经验 获得超6个赞
通过检查邮件功能的参数...
mail($to, $subject, $message, $headers);
看来问题是你的变量有点混乱。此外,“标头”并不指主题:电子邮件标头包含信息并具有自己的语法。试试这个代码:
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$mailTo = "contact@rileysunblockedgames.com";
$subject = "Report Form Message";
$headers = 'From: noreply@rileysunblockedgames.com' . "\r\n" .
'Reply-To: noreply@rileysunblockedgames.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$txt = "You have received a report form message: ".$name.".\n\n";
mail($mailTo, $subject, $txt, $headers);
header("Location: /games.html?reportsent");
}
?>
此外,在您的输入中,您必须定义“name”属性才能正常工作:
<input type="text" class="forminputproblem" name="name" id="name" placeholder="Write the problem here..." style="height:20px;font-size:14px;border-radius:6px;display:inline-block;border:1px solid #ccc;padding: 12px 20px;">
另外(有趣的是,这是你现在遇到的最大障碍),你的提交按钮的名称中有一个拼写错误,所以你的 PHP 代码永远不会运行:
<input name="submit" type="submit" value="SEND REPORT">
- 1 回答
- 0 关注
- 140 浏览
添加回答
举报