faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

72 of 93 people (77%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

Why won't my php script see the variables passed to it from the previous page in the url? ie: http://yoururl?arg1=value

Jan 26th, 2009 21:38
katie shein, healthy man, dman, magikern, Geoffrey Golliher,


This is a common problem with php 4.0.X.  the php.ini-
recommended comes with the register_globals option set to off.  if this 
is set that way php scripts will not read the args/variables passed to 
it through the url.  to correct this problem just change the 
line "register_globals = Off" to "register_globals = On" in the php.ini-
recommended and copy that file into the proper directory 
like: "cp php.ini-recommended /usr/local/php/php.ini" on linux. (you 
have to change the name of this file to php.ini for it to work 
correctly)however, if you use the php.ini-dist 
you will not have this problem as it comes with register_globals = On.  
hope this helps someone.
Geoffrey
Yes register_globals is turned off and that is the way it should be for
security reasons. What you should do instead of turning your
register_globals on is try to write your scripts
using the superglobal GET in this way: $id = $_GET["id"];.
or if you use a form you can also use POST, but GET is the best (atleast
in  my opinion) because it does'nt require a form.
magikern
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com
http://versicherungs101.blogspot.com
http://guiadeseguros.blogspot.com
http://verzekeringengids.blogspot.com
http://osiguranjevodic.blogspot.com
http://seguroguia.blogspot.com
http://ideide-cadouri.blogspot.com
http://gavoride.blogspot.com
http://donsideia.blogspot.com
http://ideeregalo1.blogspot.com
http://partideer.blogspot.com