简体   繁体   中英

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.

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'] ; if your error reporting settings allow PHP to generate the notice that it normally does for this, that would ruin your day.

Additionally (but far less likely) it's conceivable that $_SERVER['PHP_SELF'] contains some "red flag" character for HTML markup. You should always use htmlspecialchars whenever you embed a non-fixed value inside HTML, including in this case:

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). You should check them out and specify them explicitly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM