--- Jeff McKeon <[EMAIL PROTECTED]> wrote:
> The problem I'm having is with the $_GET variables. I guess I'm not
> declaring them correctly. Do I need to set them as soon as the page
> loads, and outside of any functions like so..
> 
> [code start]
> $custid = $_GET['custid'];
> $custname = $_GET['custname'];
> [code end]
> 
> Or do I need to declare them in each funtion?
> 
> [code start]
> Function blah(){
>       global $custname, $custid;
> 
>       $custid = $_GET['custid'];
>       $custname = $_GET['custname'];
>       DO SOME STUFF....
> }

$_GET is a superglobal, which just means that it is always available
everywhere. If you assign $custname to $_GET['custname'], you now have a
regular global variable (if the assignment is done outside a function) or a
local variable (if the assignment is done within a function).

So, either just use $_GET['custname'] everywhere you need it, or work with the
variable scope like you would have to if it was anything else. For example:

1. $foo = $_GET['foo'];
2. $foo = 'bar';

The variable scope of $foo would be the same, regardless of which of those
assignments were made.

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to