Ok I'll post the functions here,...
function check_realname($real_name) {
global $obj_realname;
trim($real_name);
if(!$real_name) {
echo '<font color="red">ERROR - Real name missing</font><br>';
return false;
} else {
echo 'Realname: <i>'.$real_name.'</i><br>';
echo '<input type="hidden" name="Creal_name" value="'.$real_name.'">';
$obj_realname = '1';
}
}
function check_ok($sub) {
global $obj_realname;
if($obj_realname == '1') {
if($sub == 'form') {
echo '<form method="post" action="do_form.php">';
} elseif($sub == 'submit') {
echo '<input type="submit" name="submit" value="submit">';
}
} else {
return 0;
}
}
These to are in an include file called user.php and when I include the file I want to check NOT from this file but from the file I include this file.. 🙂
Any ideas?
cwyong wrote:
Try these two method. Set $obj_realname as global variable, like this
global $obj_realname;
function check_realname(){
global $obj_realname;
}
function check_ok(){
global $obj_realname;
}
OR simply put $obj_realname as static variable
function check_realname(){
static $obj_realname;
}
the $obj_realname value should not be lost even after out of the function, but i am not sure whether this work just try and good luck.
CWYONG