Re: [PHP] Variables not working!
Try this for a generic fix if it is the globals issue: Place this somewhere to set to TRUE or FALSE when needed $GLOBAL_FIX = TRUE; use an include on every script: if($GLOBAL_VARS_FIX) { if( phpversion() = '4.2.0' ) { extract($_POST); extract($_GET); extract($_SERVER); extract($_ENV); extract($_COOKIE); } } --- Alvaro Zuniga Information Technology Professional (337) 654 6515 www.zunitek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables not working!
On 19 Jan 2004 at 21:43, Kaushan wrote: Hi, I am new to PHP scripting and struggling with the following problem. I have two files, an HTML file and a PHP file. HTML file contains a form with one text field and a submit button. When a user pressed the submit button, it calls the php file (form action=test.php ...). What the php file does is just echo back the text received from html file to the user again. Name of the text field is 'fname'. When I used this variable in the php file (as $fname) it does not contain the value of the text field. Query-string appended to the url during the submission is also correct. I checked for all syntax errors, but the codings are perfect. Do I have to change php.ini file to fix this problem. Could anyone can help me to solve this problem. Kaushan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi Kaushan Little bit difficult without seeing the code, but what you are probably sitting with is an issue with globals - depending on your method of submitting (GET or POST)you can try and check one of these two $_POST['fname'] or $_GET['fname'] for the value of the text field. Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] There are 10 kinds of people in this world, those who understand binary and those who don't (Unknown) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working!
It is most likely globals. Access the variables by... echo $_GET['fname']; or $_POST['fname']; if you are using post which it doesn't appear you do. Larry PS it is adviseable to leave globals alone in php.ini since it is set that way for security concerns. -Original Message- From: Kaushan [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 10:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Variables not working! Hi, I am new to PHP scripting and struggling with the following problem. I have two files, an HTML file and a PHP file. HTML file contains a form with one text field and a submit button. When a user pressed the submit button, it calls the php file (form action=test.php ...). What the php file does is just echo back the text received from html file to the user again. Name of the text field is 'fname'. When I used this variable in the php file (as $fname) it does not contain the value of the text field. Query-string appended to the url during the submission is also correct. I checked for all syntax errors, but the codings are perfect. Do I have to change php.ini file to fix this problem. Could anyone can help me to solve this problem. Kaushan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variables not working!
Hi, I am new to PHP scripting and struggling with the following problem. I have two files, an HTML file and a PHP file. HTML file contains a form with one text field and a submit button. When a user pressed the submit button, it calls the php file (form action=test.php ...). What the php file does is just echo back the text received from html file to the user again. Name of the text field is 'fname'. When I used this variable in the php file (as $fname) it does not contain the value of the text field. Query-string appended to the url during the submission is also correct. I checked for all syntax errors, but the codings are perfect. Do I have to change php.ini file to fix this problem. Could anyone can help me to solve this problem. Kaushan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variables not working
Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables not working
Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables not working
Before you get carried away with registering globals, try echoing: $_SERVER[HTTP_USER_AGENT]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS[HTTP_USER_AGENT]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: baldey_uk Cc: Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working
Um ok i can understand that this can be unsecure, how do i pass html variables to php witout the use of globals? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER[HTTP_USER_AGENT]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS[HTTP_USER_AGENT]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: baldey_uk Cc: Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working
Sorry let me rephrase that ' can anyone point me to good docs about passing variables between html and php' please? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER[HTTP_USER_AGENT]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS[HTTP_USER_AGENT]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: baldey_uk Cc: Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables not working
I do a link to http://blah.com/do.php?varbiable=passed I'm not sure of any docs though, sorry. Mike - Original Message - From: baldey_uk [EMAIL PROTECTED] To: Nathan [EMAIL PROTECTED]; Rasmus Lerdorf [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 26, 2002 10:29 PM Subject: RE: [PHP] Variables not working Sorry let me rephrase that ' can anyone point me to good docs about passing variables between html and php' please? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER[HTTP_USER_AGENT]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS[HTTP_USER_AGENT]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: baldey_uk Cc: Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working
Read these: Variables from outside PHP: http://uk.php.net/manual/en/language.variables.external.php It gives an example using $HTTP_POST_VARS. This is but one predefined variable, others can be read about here: Predefined Variables: http://ca.php.net/manual/en/language.variables.predefined.php Also consider extract and import_request_variables, I posted a bit about them awhile back here: http://marc.theaimsgroup.com/?l=php-generalm=101803683730027 And when in doubt, send your script to a call of phpinfo() and it'll provide a ton of useful information. Regards, Philip Olson p.s. the above links contain links, see those too :) On Sat, 27 Apr 2002, baldey_uk wrote: Sorry let me rephrase that ' can anyone point me to good docs about passing variables between html and php' please? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER[HTTP_USER_AGENT]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS[HTTP_USER_AGENT]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: baldey_uk Cc: Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working
http://www.php.net/manual/en/security.registerglobals.php On Sat, 27 Apr 2002, baldey_uk wrote: Sorry let me rephrase that ' can anyone point me to good docs about passing variables between html and php' please? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER[HTTP_USER_AGENT]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS[HTTP_USER_AGENT]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: baldey_uk Cc: Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even ?php echo $HTTP_USER_AGENT; ? doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php