【问题标题】:php localhost sumbmission 404 errorphp localhost 提交 404 错误
【发布时间】: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 进行比较。您在某处输入了错误。
  • &lt;input type=submit name=Send value=Send&gt;
  • 404 错误?那么,如果不是ReportForm.php,那么调用的脚本是什么?

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


【解决方案1】:

(关于没有收到...)

我认为应该是:

if ($_POST["Send"]) {

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

【讨论】:

    猜你喜欢
    • 2017-08-30
    • 2015-09-26
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2021-06-10
    • 2019-06-20
    • 2017-08-24
    • 1970-01-01
    相关资源
    最近更新 更多