form action and IE7 error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scorch
Forum Newbie
Posts: 2
Joined: Wed Jun 06, 2007 4:58 pm

form action and IE7 error

Post 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?
User avatar
maliskoleather
Forum Contributor
Posts: 155
Joined: Tue May 15, 2007 2:19 am
Contact:

Post 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).
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Don't use PHP_SELF. If you want to reference the current file, try basename(__FILE__).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The action can be "#" in this case without issue on that end.
scorch
Forum Newbie
Posts: 2
Joined: Wed Jun 06, 2007 4:58 pm

Post 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
Post Reply