简体   繁体   English

PHP自提交表单在FF和Chrome中运行但不在IE中运行(404错误)

[英]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.

相关问题 PHP SQL UPDATE在FF和CHROME中有效,但在IE中不起作用? - PHP SQL UPDATE works in FF and CHROME but not in IE? PHP Form无法在IE和Chrome上正常运行,但在FF中可以正常使用 - PHP Form not working IE and Chrome, but fine in FF php代码在ie上的表单提交上不起作用(但在chrome,ff上工作正常) - php code doesn`t work on form submit on ie (but works fine on chrome, ff) chrome的页面加载时,即ff在PHP中触发表单验证错误消息 - On page load for chrome, ie, ff triggers form validation error message in PHP ff和chrome中的mysql_data_seek错误,但在ie中有效 - mysql_data_seek error in ff and chrome, but works in ie PHP表单不起作用。 在IE / FF中显示正常,而不是在Chrome中显示。 - PHP form not working. displays fine in IE/FF, not in chrome. PHP联系表单不适用于FF,但适用于Edge IE chrome和safari - PHP contact form not working in FF but working in Edge IE chrome and safari PHP表单可在IE中使用,但不适用于Chrome或Firefox - PHP form works in IE, but not Chrome or Firefox PHP 表单在 Firefox 中正常工作,但在 IE 和 Chrome 中无法正常工作 - PHP Form Works Correctly in Firefox, but not in IE and Chrome 用于自动登录的jQuery .submit适用于FF,Chrome ...而不是IE - jQuery .submit for autologin works in FF,Chrome… not IE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM