[thelist] a PHP function question - solved

Bob Meetin ontheroad at frii.com
Sun Feb 11 23:09:31 CST 2007


that was it - i had the variable listed earlier (outside) the function - 
not realizing how this worked. thx

misterhaan wrote:
> Bob Meetin wrote:
>   
>> function censor ($data)
>>    {
>>     if (eregi('[gambl]', $data)) { $message = "inappropriate content - submission denied"; $pass = "NO"; }
>>     return $data;
>>     echo "p: $pass<br>"; // this is just a test to see if the variable is set - and it fails.
>>    }
>>
>> unfortunately calling the function doesn't return the $pass variable to 
>> the form (either within the function or in the form).  what am i missing
>>     
> the echo line will never get called since it's immediately after a 
> return statement.
> if you want $pass to have wider scope than just the function, just put 
> "global $pass;" as the first line of your function
>   




More information about the thelist mailing list