Jochem wrote:
>one interim solution could be to write a function that fills the $_GET
>and $_POST vars - getting an array from a string like
>"var1=334343&var2=343434" is fairly trivial how does the following work
Thanks but this would be impractical for the real application. I need to
gather
customer data and write it to the database. I would likely use POST. I
couldn't
get POST to work either but am using _GET right now since I can at least
see the query string value.
>probably a stupid question but: do you actually need tomcat? why not try
>a vanilla setup to begin with?
I need Tomcat for a Java app we run and this is the standard here.
I tried print_r( $GLOBALS ); and print_r( $HTTP_GET_VARS ) and print_r(
$HTTP_POST_VARS )
This is the output, as you can see _$HTTP_GET_VARS are empty. THis is
perplexing......
[argc] => 3
[HTTP_POST_VARS] => Array
(
)
[_POST] => Array
(
)
[HTTP_GET_VARS] => Array
(
)
[_GET] => Array
(
)
[HTTP_COOKIE_VARS] => Array
(
)
[_COOKIE] => Array
(
)
[HTTP_SERVER_VARS] => Array
(
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.0; FunWebProducts; .NET CLR 1.1.4322)
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[REQUEST_METHOD] => GET
[AUTH_TYPE] =>
[HTTP_ACCEPT_LANGUAGE] => en-ca
[SERVER_NAME] => localhost
[SERVER_SOFTWARE] => TOMCAT
[HTTP_REFERER] => http://localhost:8080/ip7/posttest.html
[HTTP_HOST] => localhost:8080
[GATEWAY_INTERFACE] => CGI/1.1
[X_TOMCAT_SCRIPT_PATH] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[REMOTE_ADDR] => xxxxxxxxxxxxx
[SERVER_PROTOCOL] => HTTP/1.1
[PATH_INFO] =>
[REMOTE_HOST] => xxxxxxxxxxxx
[QUERY_STRING] => var1=1111111111111&var2=222222222
[HTTP_CONNECTION] => Keep-Alive
[SERVER_PORT] => 8080
[CONTENT_TYPE] =>
[CONTENT_LENGTH] =>
[SCRIPT_NAME] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[HTTP_ACCEPT] => */*
[REMOTE_USER] =>
[REMOTE_IDENT] =>
[PHP_SELF] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[SCRIPT_FILENAME] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[PATH_TRANSLATED] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[DOCUMENT_ROOT] =>
[argv] => Array
(
[0] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[1] => var2=222222222
[2] => var1=1111111111111
)
[argc] => 3
)
[_SERVER] => Array
(
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.0; FunWebProducts; .NET CLR 1.1.4322)
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[REQUEST_METHOD] => GET
[AUTH_TYPE] =>
[HTTP_ACCEPT_LANGUAGE] => en-ca
[SERVER_NAME] => localhost
[SERVER_SOFTWARE] => TOMCAT
[HTTP_REFERER] => http://localhost:8080/ip7/posttest.html
[HTTP_HOST] => localhost:8080
[GATEWAY_INTERFACE] => CGI/1.1
[X_TOMCAT_SCRIPT_PATH] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[REMOTE_ADDR] => xxxxxxxxxxxxxx
[SERVER_PROTOCOL] => HTTP/1.1
[PATH_INFO] =>
[REMOTE_HOST] => xxxxxxxxxxxx
[QUERY_STRING] => var1=1111111111111&var2=222222222
[HTTP_CONNECTION] => Keep-Alive
[SERVER_PORT] => 8080
[CONTENT_TYPE] =>
[CONTENT_LENGTH] =>
[SCRIPT_NAME] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[HTTP_ACCEPT] => */*
[REMOTE_USER] =>
[REMOTE_IDENT] =>
[PHP_SELF] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[SCRIPT_FILENAME] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[PATH_TRANSLATED] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[DOCUMENT_ROOT] =>
[argv] => Array
(
[0] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
[1] => var2=222222222
[2] => var1=1111111111111
)
[argc] => 3
)
[HTTP_ENV_VARS] => Array
(
)
[_ENV] => Array
(
)
[HTTP_POST_FILES] => Array
(
)
[_FILES] => Array
(
)
[_REQUEST] => Array
(
)
[GLOBALS] => Array
*RECURSION*
)
Array
(
)
Array
(
)
-----Original Message-----
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: December 21, 2004 7:31 PM
To: Keane, Warren A FIN:EX
Cc: [email protected]
Subject: Re: [PHP-DB] _POST, _GET, _REQUEST not working
Warren wrote:
> Thanks for your response Jochem.
>
cheers.
> 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.
bummer. I have a sneaking suspicion that your problem might be related
to the fact that you are running the cgi version of php.
> Funny thing, $_SERVER[QUERY_STRING] returns the query string
one interim solution could be to write a function that fills the $_GET
and $_POST vars - getting an array from a string like
"var1=334343&var2=343434" is fairly trivial how does the following work
for you?
parse_str( $_SERVER['QUERY_STRING'], $_GET );
print_r($_GET);
obviously this leaves you nowhere with POST & COOKIE values.
> "var1=334343&var2=343434" but $_GET['var1'] or $_REQUEST['var1'] are
empty.
which of the superglobals are actually defined at all?
> phpinfo() shows
> SERVER["argv"] => Array
what does:
print_r( $GLOBALS );
print_r( $HTTP_GET_VARS );
print_r( $HTTP_POST_VARS );
...show you? (you might want to wrap the output in PRE tags for legibility)
> (
> [0] =>
/home/www/jakarta-tomcat-5.0.25/webapps/ip7/WEB-INF/cgi/httptest.php
probably a stupid question but: do you actually need tomcat? why not try
a vanilla setup to begin with?
have you read this page:
http://nl.php.net/manual/en/language.variables.predefined.php#language.varia
bles.superglobals
if not why not? (read the manual from back to front, it save you lots of
time in the long run)
> [1] => var2=343434
> [2] => var1=334343
> )
> Very puzzling.
>
> Anyone else?
>
>
> -----Original Message-----
> From: Jochem Maas [mailto:[EMAIL PROTECTED]
> Sent: December 20, 2004 5:53 PM
> To: Keane, Warren A FIN:EX
> Cc: [email protected]
> 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.
>>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php