【发布时间】:2015-12-16 09:18:34
【问题描述】:
我根据答案修复了大部分问题,但似乎还有更多错误我没有足够的知识找到,我在提交按钮上添加了一个名称,我使用开发人员工具监控运行它,它说错误在于打开的 php 标记和明显不平衡的
标记,任何帮助将不胜感激<!DOCTYPE html>
<html>
<head>
<title>Submit a Report</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h2>Send a report to our administrators</h2>
<form method="POST" action="ReportForm.php">
Offending Player's username:<br>
<input type="text" name="theirName"><br><br>
What did they do?:<br>
<input type="text" name="message" size="10"><br><br>
Your Minecraft Username:<br>
<input type="text" id="yourName" name="yourName"><br><br>
<input type="submit" name="Send" value="Send">
<input type="reset" value="Reset">
</form>
</body>
</html>
<?php
$name = $_POST['yourName'];
$playerName = $_POST['theirName'];
$message = $_POST['message'];
$email_to = 'reports.ahricraft@gmail.com';
$email_subject = "Issue with Player";
$email_body = "From: $name\n Offending player: $playerName\n Reason for report:\n $message";
mail($email_to, $email_subject, $email_body);
if ($_POST["Send"]) {
if (mail($email_to, $email_subject, $email_body)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
}
?>
【问题讨论】:
-
是这个php脚本reportForm.php的名字吗?
-
html 和 php 保存在同一个名为 ReportForm.php 的文件中,我也更正了表单操作,但仍然是 404
-
在浏览器上打开表单时复制 URL,并在收到 404 时将其与 URL 进行比较。您在某处输入了错误。
-
<input type=submit name=Send value=Send> -
404 错误?那么,如果不是
ReportForm.php,那么调用的脚本是什么?
标签: php forms submit http-status-code-404