Page 1 of 1

form action and IE7 error

Posted: Wed Jun 06, 2007 5:29 pm
by scorch
here's something I stubled across

i've got a simple php page that includes another php file that's all it does. The script that is loaded contains a form that has the following action
<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">

this works fine in all browsers tested except IE7

I've found a workaround that I don't really like. if I rename the php that loads the other php as index.html it works.

any idea why they would do this to me?

Posted: Wed Jun 06, 2007 5:37 pm
by maliskoleather
have you checked the source in IE7 to see what is being passed to the browser?

...sometimes the PHP_SELF variable doesn't have a proper value (or any at all).

Posted: Wed Jun 06, 2007 5:42 pm
by RobertGonzalez
Don't use PHP_SELF. If you want to reference the current file, try basename(__FILE__).

Posted: Wed Jun 06, 2007 9:13 pm
by feyd
The action can be "#" in this case without issue on that end.

Posted: Thu Jun 07, 2007 5:35 pm
by scorch
I found what the problem was
instead of using
<form action=\"\" method=\"post\">
I used
<form action=\" \" method=\"post\">

a space can make a huge difference, since I had that line at couple of places I missed the one line where it wasn't and turns out IE doesn't like it.

thanks for your imput