Fukushousha Posted April 7, 2008 Share Posted April 7, 2008 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 More sharing options...
jeffman Posted April 7, 2008 Share Posted April 7, 2008 $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 More sharing options...
Fukushousha Posted April 7, 2008 Author Share Posted April 7, 2008 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 More sharing options...
Lulzim Posted April 7, 2008 Share Posted April 7, 2008 http://www.php.net/variables.predefinedI think there is all the information you need. Link to comment Share on other sites More sharing options...
Fukushousha Posted April 7, 2008 Author Share Posted April 7, 2008 Wooohooo thanks Lulzim... now I know how to kill the time in here. Thanks to both of you Link to comment Share on other sites More sharing options...
jeffman Posted April 7, 2008 Share Posted April 7, 2008 Additional text here: http://us3.php.net/reserved.variablesMy favorite sentence: "You may or may not find any of the following elements in $_SERVER."While we're at it, let's just add some new conditionals to the language: if ($x might= 42) { if $_SERVER['feels_good_about_itself']{ $x++; }} else { okay();} Link to comment Share on other sites More sharing options...
justsomeguy Posted April 7, 2008 Share Posted April 7, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.