php localhost sumbmission 404错误

时间:2015-09-19 07:02:56

标签: php forms submit http-status-code-404

我根据答案解决了大部分问题,但似乎有更多的错误,我的知识不足以找到,我在提交按钮中添加了一个名称,我使用开发人员工具监控它并运行它说错误是打开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>';
    }
}
?>

1 个答案:

答案 0 :(得分:0)

(关于没有收到......)

我认为应该是:

if ($_POST["Send"]) {

您的提交按钮的名称值为“发送”。