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 |
|
|||
|
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.
|
|
|
|
|||
|
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... |
|
|||
|
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.. |
|
|||
|
Quote:
|
|
||||
|
use this code instead of the first line of code you posted in the first post:
|
|
|||
|
Tried the most recent suggestion - same problem:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' |
|
||||
|
are you sure that error is the same line of code? because i get no error with the code i gave you...
|
|
|||
|
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. |
|
|||
|
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. |
|
||||
|
you still need to change that line to
|
|
|||
|
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? |
|
|||
|
Have a look at a PHPInfo screen:
|
|
||||
|
I think he's tried that one, but yeah - comparing the .ini files would be the same as comparing the phpinfo pages.
|
|
|||
|
Y'all are going to hate me.
Now, using the concactenated version of $_Server['php_self'] and turning on error readouts, it at least gets through the action part of the form and that evaluates correctly. Now its giving me UNDEFINDED VARIABLE errors for every variable in the code. WHY?!! This code works on my other server, why isn't it working here!? |
![]() |
| Tags |
| php, form, results, php_self, blank |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Publicly viewable form results? | wealthy199 | Starting Out | 5 | Sep 27th, 2007 14:59 |
| Getting form results to email as an .html | griffster122 | Starting Out | 1 | May 29th, 2007 01:44 |
| Problem with results of form | Otter | PHP Forum | 2 | Nov 7th, 2006 13:35 |
| Viewing form results ??????? | cat101 | PHP Forum | 3 | Apr 25th, 2006 23:57 |
| Submitting Web form results to a database | theproman23 | Databases | 2 | Jun 30th, 2005 13:21 |