Posted by David Haynes on 05/22/06 17:16
Barkster wrote:
> This is the simplified way I have it now:
>
> $var = true;
> $var2 = 2;
>
> function getval() {
> display();
> }
>
> function display() {
> if($var) echo 'true' //not getting a value for $var?
> }
>
> <body>
> </php getval(); ?>
> </body>
>
As others have said, there are many ways to do this. Either:
function display($var) {
if( $var ) echo 'true';
]
would work, or:
function display() {
global $var;
if( $var ) echo 'true';
}
would also work.
-david-
Navigation:
[Reply to this message]
|