This is a discussion on "PHP form results $PHP_self is blank" within the PHP Forum section. This forum, and the thread "PHP form results $PHP_self is blank are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP form results $PHP_self is blank
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
PHP form results $PHP_self is blank
I'm redesigning my company's website, and I've run across a problem.
I installed PHP on our webserver, and phpinfo shows up just fine! Problem is that when I try to use the page I designed as a feedback form, it fails to get a value for $PHP_SELF. Even when explicitly defined with the complete url (http://thisserver.com/thisisthephpdoc.php) it DOESN'T WORK. What really sucks is that the form WORKS on my own webserver (which I didn't set up). So it has to be some setting in PHP on this server. I have the form defined as a variable in the php document itself. Anyway, here's where its called.
|
|
#2
|
||||
|
||||
|
try using $_SERVER['PHP_SELF'] instead of just $PHP_SELF
|
|
#3
|
|||
|
|||
|
This is to do with the 'register globals' setting which can be found in your php.ini file. When you want to use a GET, POST or SERVER variable in your PHP page you should really refer to it using it's full name.
Eg: $_SERVER['PHP_SELF'] $_POST['name'] On most servers register_globals this should really be turned off, otherwise someone can send a get variable to your script and, if you haven't declared variables before you use them, override certain sections of your code... |
|
#4
|
|||
|
|||
|
I tried using the $_server['php_self'] but it gave me a weird parse error.
I made a test page consisting of this:
Still, shouldn't it work if I explicitly set the file using the FULL http address? Shouldn't that work? It doesnt.. |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
||||
|
||||
|
use this code instead of the first line of code you posted in the first post:
|
|
#7
|
|||
|
|||
|
Tried the most recent suggestion - same problem:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' |
|
#8
|
||||
|
||||
|
are you sure that error is the same line of code? because i get no error with the code i gave you...
|
|
#9
|
|||
|
|||
|
Its gotta be the server I'm working with. All the code WORKS on my own domain - a server that i didn't set up though, so I don't know how they have their PHP ini file configured.
The annoying part is that it SHOULD work. But its not. |
|
#10
|
||||
|
||||
|
What line number is the error reporting? Can you post that line of code for us?
|
|
#11
|
|||
|
|||
|
Here's the page in its entirety on MY webserver, on which it works properly. I know it isn't my code because it works properly on this testing server.
http://www.primitivemelody.us/test/contact.php On our company's webserver, the file fails to work properly. Here is the EXACT same file on our server, and it won't work. http://www.gemandjewelry.tv/testing/contact.php The line of code in question is line 42:
Thanks so much for all the help so far, btw. |
|
#12
|
||||
|
||||
|
you still need to change that line to
|
|
#13
|
|||
|
|||
|
Quote:
The only other thing I can think of is that possibly the mail() command settings in the PHP.ini file aren't right (I have them set to send mail through our gmail account), but that wouldn't make something like that not work properly, would it? |
|
#14
|
|||
|
|||
|
Have a look at a PHPInfo screen:
|
|
#15
|
||||
|
||||
|
I think he's tried that one, but yeah - comparing the .ini files would be the same as comparing the phpinfo pages.
|
|
#16
|