I'm slowly converting my work mode to functions and as well, OOP.
I have a file, functions.php which I call at the top of a log in page.
When the form on the page is submitted, I use a function within the functions file to check details entered are correct. If not I do e.g.
if ($how_many<1){
$error .= "<p>You typed the wrong email address and/or password.</p>";
return $error;
}
I then have another function named anyerrors in the same functions file. This is:
function anyerrors($error){
echo $error;
}
UPDATE: Then in the file I call anyerrors($error); where I want the error to be shown.
But nothing is being shown? I'm guessing it's because I'm creating the variable in one function and it's not getting to the other function.
Am I way off in my logic?
For the record I'm an old school coder I guess and taking time to change my work flow radically one step at a time.
$error. You need to assign the result to something. "old school coder"? Calling functions and returning values from them is the way people have been programming for decades.if($how_many<1)inside a function? It must be, since it usesreturn. Does the caller of that function assign its value to$error?