$emailto is in the global scope, so it's not accessible like that.

You can do it one of three ways:

$emailto = $_GET['EmailTO'];

function wtemp_mainbody() {
    global $emailto;
    print "Contact (";
    echo $emailto;
    print ") Info";
}
 or

$emailto = $_GET['EmailTO'];

function wtemp_mainbody() {
    print "Contact (";
    echo $GLOBALS['emailto'];
    print ") Info";
}
or (recommended)

function wtemp_mainbody() {
    print "Contact (";
    echo $_GET['EmailTO'];
    print ") Info";
}
-----Original Message-----
From: Louie Miranda [mailto:[EMAIL PROTECTED]
Sent: Monday, December 15, 2003 8:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP] can't access a GET variable on function?


$emailto = $_GET['EmailTO'];

function wtemp_mainbody() {
    print "Contact (";
    echo "$emailto";
    print ") Info";
}

Why can't i display a GET variable from a function? Or should i registered
it on global session?




-- -
Louie Miranda
http://www.axishift.com

-- 
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

Reply via email to