Jump to content

$HTTP_SERVER_VARS['PHP_SELF'] problem


Fukushousha

Recommended Posts

Hello all!I am trying to make a register form and I have a problem. The form tag is like that :<form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post"> but when I execute it in my server I can see that the browser is communicating with the server BUT after that I get a page not found error.On the contrary it works like a charm if I write :<form action="register.php" method="post"> where register.php is the .php file itself where the whole script is stored.Now I must admit I don't understand it. I mean isn't the $HTTP_SERVER_VARS['PHP_SELF'] supposed to be the file name of the script itself? Anyone knows what the problem might be?

Link to comment
Share on other sites

$HTTP_SERVER_VARS is a bit old fashioned, and it is not a superglobal, like $_POST or $_SERVER, and I believe it will be gone as of php 6. Try using $_SERVER['PHP_SELF'].Note, do a View Source of the rendered page to see what that variable actually returns.

Link to comment
Share on other sites

I am at uni right now and I can't acces my testing site server from here. I will be sure to try it when I get home though. Thanks a lot for the help.Smaller question: Everything I could do with $HTTP_SERVER_VARS I can also do with $_SERVER?I am asking here since even though I can search easily for functions in the php manual, I don't seem to be able to search for superglobal variables like this.

Link to comment
Share on other sites

There's a good reason for that though.

The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...