【发布时间】:2012-04-16 05:24:46
【问题描述】:
我有一个包含 2 个必填字段(电子邮件和消息)和 2 个非必填字段(姓名和号码)的表单。当您只填写必填字段时,它提交很好,但是当提交非必填字段时,它会生成 404。如果这有任何相关性,我正在使用 wordpress。
<form id="question" action="thankyou" method="post">
<p class="question-label">Type your email address here...</p>
<input id="email" name="email" type="text"></input>
<h3>Your Question...</h3>
<textarea id="message" name="message"></textarea>
<input id="submit" name="submit" type="submit" value="GO" />
<p>If you would like us to call you please enter you Name and Contact Number here:</p>
<p class="question-label">Name</p>
<input id="name" name="name" type="text"></input>
<p class="question-label">Contact Number</p>
<input id="number" name="number" type="text"></input>
</form>
【问题讨论】:
-
您确定是 404,而不是空白页吗?
-
是的,页面正在生成404错误页面。
-
真实的 404?使用 HTTP 标头声明 404?我问的原因是因为如果它不是 404 - 它是一个空白页面 - 它可能由您的表单处理器在发送所有标题之前回显某些内容触发,从而中断流程。尝试将动作更改为“?”而不是“#”。
-
抱歉 - 代码不是最新的。它转到一个单独的页面而不是'#'。已更新。
-
啊。只是一个快速的建议,你可能想在那里放一个更绝对的 URL;例如:/thankyou/(假设它是一个自定义页面。)原因是 WP 将从最近到精确的页面重定向,它可能会在此过程中丢失数据或阻塞。
标签: html forms wordpress http-status-code-404