RE: [PHP-DB] _POST, _GET, _REQUEST not working
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 23 December 2004 01:12, Keane, Warren A FIN:EX wrote: I did try if (empty($_GET)) { parse_str($_SERVER['QUERY_STRING'],$_GET); } which worked so I guess I should be able to come up with an equivalent for _POST using argv, argc. I am guessing but I also think the problem is to do with the fact that the CGI sapi is being used. I am using the CLI SAPI, I checked using php_sapi_name(). Is this causing the problem? Absolutely -- this is the Command-Line Interface. As this is intended for command-line scripting, it has no notion of being used in a Web context and does not even attempt to fill the $_POST or $_GET (or most of the other $_) arrays. You need to use either the CGI SAPI, or the Apache module. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] _POST, _GET, _REQUEST not working
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 20 December 2004 21:50, 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 a form generating even though I can see the query string values in the URL as in: http://localhost:8080/ip7/httptest.php?var1=212122var2=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; 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 Is this a direct paste from your original? If so, there's an obvious error here -- one of those should be $var2,'cos as it is you're never even echoing the value of the $_GET parameter. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] _POST, _GET, _REQUEST not working
Hi Mike, You are a sharp one but alas that is not my real code. The real code for displaying var1 and var2 is: echo pvariable 1 : $var1 /p br ; echo pvariable 2 : $var2 /p br ; I have tried so many things to get this working, I am starting to think it is a CGI problem. -Original Message- From: Ford, Mike [mailto:[EMAIL PROTECTED] Sent: December 22, 2004 4:16 AM To: Keane, Warren A FIN:EX; php-db@lists.php.net Subject: RE: [PHP-DB] _POST, _GET, _REQUEST not working To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 20 December 2004 21:50, 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 a form generating even though I can see the query string values in the URL as in: http://localhost:8080/ip7/httptest.php?var1=212122var2=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; 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 Is this a direct paste from your original? If so, there's an obvious error here -- one of those should be $var2,'cos as it is you're never even echoing the value of the $_GET parameter. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] _POST, _GET, _REQUEST not working
On Thursday 23 December 2004 03:12, Keane, Warren A FIN:EX wrote: You are a sharp one but alas that is not my real code. The real code for displaying var1 and var2 is: Is there any reason why you originally posted bogus code and not your real code? When you post code, please make sure it's verbatim and is the actual code that you're having problems with. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* System going down in 5 minutes. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] _POST, _GET, _REQUEST not working
( ) -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: December 21, 2004 7:31 PM To: Keane, Warren A FIN:EX Cc: php-db@lists.php.net 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=334343var2=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=334343var2=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: 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=212122var2=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
Re: [PHP-DB] _POST, _GET, _REQUEST not working
Keane, Warren A FIN:EX wrote: 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=334343var2=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. ok - I assume then that POST values don't appear in argv as GET values do? if they do then the proposition stands. 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 notice that your running tomcat on port 8080, maybe its a possibility to run tomcat an a vanilla apache setup next to each other (no diff ports obviously) - one for the java webapp and one for the php stuff (apache with apache php sapi, preferably statically linked cos thats faster)... I am guessing but I also think the problem is to do with the fact that the CGI sapi is being used. a bit desperate but... you could go thru purmatationS of the following ini setting to see if your problem goes away: variables_order register_globals register_argc_argv register_long_arrays if that doesn't do it maybe its time to build the webserver from scratch again (also is there a reason to use the CGI? - is there not a sapi for tomcat?) I'm afraid I'm out of ideas, hope you figure it out! ... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] _POST, _GET, _REQUEST not working
Jochem wrote: 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. ok - I assume then that POST values don't appear in argv as GET values do? if they do then the proposition stands. I did try if (empty($_GET)) { parse_str($_SERVER['QUERY_STRING'],$_GET); } which worked so I guess I should be able to come up with an equivalent for _POST using argv, argc. I am guessing but I also think the problem is to do with the fact that the CGI sapi is being used. I am using the CLI SAPI, I checked using php_sapi_name(). Is this causing the problem? Cheers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] _POST, _GET, _REQUEST not working
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=334343var2=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:[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=212122var2=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
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=334343var2=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=334343var2=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.variables.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=212122var2=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
[PHP-DB] _POST, _GET, _REQUEST not working
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 a form generating even though I can see the query string values in the URL as in: http://localhost:8080/ip7/httptest.php?var1=212122var2=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; 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. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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=212122var2=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
Re: [PHP-DB] $_POST And $_REQUEST
$_REQUEST is an associative array consisting of the contents of $_GET, $_POST, $_COOKIE, and $_FILES Also, they are not function but arrays, as Hatem said. You can usa $_REQUEST as a catch-all that provides you with both what was passed to your page through the URL query ($_GET) and what was posted to the webserver through HTTP ($_POST). IMHO, it's always better to use the more specific arrays ($_GET or $_POST), because that makes your pages more accurate and, therefore, less open to possible attacks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] $_POST And $_REQUEST
Hi all, What is the difference between the $_POST and $_REQUEST functions (I can't find it in the docs)? Thanks, Taj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $_POST And $_REQUEST
$_REQUEST is an associative array consisting of the contents of $_GET, $_POST, $_COOKIE, and $_FILES http://www.php.net/manual/en/reserved.variables.php - Original Message - From: Shoulder to Shoulder Farm [EMAIL PROTECTED] To: PHP Database List [EMAIL PROTECTED] Sent: Sunday, October 06, 2002 1:50 AM Subject: [PHP-DB] $_POST And $_REQUEST Hi all, What is the difference between the $_POST and $_REQUEST functions (I can't find it in the docs)? Thanks, Taj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php