[thelist] PHP register_globals

J Nicholas Tolson jtnt at mindspring.com
Wed Jun 2 13:07:58 CDT 2004


In your example, you'd use the following to reference the query string:

$_GET['var1']

More info here:

http://us3.php.net/variables.predefined


Nicholas



On 6/2/04 10:19 AM, "Dave Stevens" <dave at stemfiction.com> wrote:

> Hi List,
> 
> I got started in PHP by using various tutorials around the web, and
> learnt that you could do:
> 
>  www.somesite.com/file.php?var1=something
> 
> and then set the response of the browser by doing:
> 
>  if ($var1) {
> 
>    do something to do with var1;
> 
>    } else {
> 
>    do something for the default state;
> 
>    }
> 
> 
> However I've sinced found that with register_globals set to off, this
> won't work. Its not a major problem so far as my host has it on as
> default but I've heard plenty of reasons for setting it to off.
> 
> So what I'm wondering is how you make use of the query string
> 
>  www.somesite.com/file.php?var1=something
> 
> and reference it without the help of register_globals...
> 
> Googling this resulted in yet more reasons to turn off register_globals
> but nothing that told me how to work without it.
> 
> Thanks in advance
> Dave



More information about the thelist mailing list