[英]PHP Self Submitting Form Works in FF and Chrome but not IE (404 error)
I'm a little stumped. 我有点难过。 I've been pulling my hair out tring to figure this out.
我一直在拉着头发去弄清楚这一点。 The PHP self submitting form works fine in Fire Fox and Chrome but when I try it in IE, I receive a 404 error.
PHP自我提交表单在Fire Fox和Chrome中运行良好但是当我在IE中尝试它时,我收到404错误。
Here are my form tags: 这是我的表单标签:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"
name="New Policy/Procedure Form" id="form_name">
//content
<input type="submit" value="submit" id="submit" name="submit" />
Any help is much appreciated! 任何帮助深表感谢!
You should put PHP_SELF
inside quotes: $_SERVER['PHP_SELF']
; 你应该把
PHP_SELF
放在引号内: $_SERVER['PHP_SELF']
; if your error reporting settings allow PHP to generate the notice that it normally does for this, that would ruin your day. 如果你的错误报告设置允许PHP生成它通常为此做的通知,那将毁了你的一天。
Additionally (but far less likely) it's conceivable that $_SERVER['PHP_SELF']
contains some "red flag" character for HTML markup. 另外(但不太可能)可以想象
$_SERVER['PHP_SELF']
包含一些HTML标记的“红旗”字符。 You should always use htmlspecialchars
whenever you embed a non-fixed value inside HTML, including in this case: 每当在HTML中嵌入非固定值时,都应该始终使用
htmlspecialchars
,包括在这种情况下:
action="<?php echo htmlspecialchars($_SERVER[PHP_SELF]); ?>"
htmlspecialchars
has other parameters as well, the default values of which are OK most of the time (but not always). htmlspecialchars
也有其他参数,其默认值大部分时间都可以(但不总是)。 You should check them out and specify them explicitly. 您应该检查它们并明确指定它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.