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
Feb 24th, 2008 19:43
dman, magikern, Geoffrey Golliher, http://www.ttnr.org
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