_POST, _GET, _REQUEST not working
| From: | Warren | Date: | Wed, 22 Dec 2004 00:01:00 +0000 |
| Subject: | _POST, _GET, _REQUEST not working | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37779@lists.php.net to get a copy of this message | ||
Thanks for your response Jochem.
I realize this is not a DB specific question but this exercise is to get my
mysql routines working.
I did remove the declaration "global $_SERVER, $_GET, $_POST, $_REQUEST,
$_SESSION, $_COOKIE" but still do not get values.
Funny thing, $_SERVER[QUERY_STRING] returns the query string
"var1=334343&var2=343434" but $_GET['var1'] or $_REQUEST['var1']
are empty.
phpinfo() shows
SERVER["argv"] => Array
(
[0] => /home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[1] => var2=343434
[2] => var1=334343
)
Very puzzling.
Anyone else?
-----Original Message-----
From: Jochem Maas [mailto:jochem@iamjochem.com]
Sent: December 20, 2004 5:53 PM
To: Keane, Warren A FIN:EX
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] _POST, _GET, _REQUEST not working
Warren wrote:
> Hello,
>
> I am running PHP 4.39 as a CGI under Tomcat 5.025, Linux 2.4.20-31.9.
> Configure = './configure' '--with-java=/usr/java/j2sdk1.4.2_04'
> '--with-servlet=/home/www/jakarta-tomcat-5.0.25' '--with-mysql'
>
> I cannot get the _GET function or _REQUEST functions to pick up values
from
they are variables not functions.
> a form generating even though I can see the query string values in the URL
> as in:
>
> http://localhost:8080/ip7/httptest.php?var1=212122&var2=343434
>
> My HTML is very simple:
>
> <form
> action="http://localhost:8080/ip7/httptest.php"
> method="get">
> <input type="text" name="var1">
> <input type="text" name="var2">
> <input type="submit">
> </form>
>
> The PHP program httptest.php is also very simple:
>
> <?PHP
> global $_SERVER, $_GET, $_POST, $_REQUEST, $_SESSION, $_COOKIE;
all the vars listed above are super globals you don't have to declare
them as global - they are everywhere! this may also be the cause of the
problem, what happens when you remove this line?
also have you tried var_dump() or print_r() on the $_GET/$_POST/etc arrays?
ps - not a very DB related question is it?
>
> if(!empty($_REQUEST['var1'])) { $var1 = $_REQUEST['var1']; }
> else { $var1 ='undefined'; }
>
> if(!empty($_GET['var2'])) { $var2 = $_GET['var2']; }
> else $var2 ='undefined';
>
> // Various HMTL tags removed for simplicity
> echo $var1
> echo $var1
> ?>
>
> I have tried everything I can think of including using HTML POST instead
of
> GET, setting register_globals = On/Off.
leaving this off is recommended.
>
> Thanks in advance.
>