Hi everybody,
First let me preface this by saying that I'm not very good with PHP so if my issue sounds easy/stupid then please forgive me.
I have something driving me crazy. What I'm trying to do is check whether a variable is populated or not and if so set a boolean to true and vice versa.
Seems easy enough. I works when I print it to the screen. When I'm logged it $auth returns 1 and 0 when I'm not.
What I don't get is that I'm then trying to use the $auth variable to determine if a link should be printed around a calendar date or not. This is not working and it's driving me nuts.
Again, seems easy enough, but all I ever get is the blank number ($day) even if the $auth variable is set to true.
I'm hoping this is just a quick syntax or code problem. Any help on this would be greatly appreciated.
Thanks.
First let me preface this by saying that I'm not very good with PHP so if my issue sounds easy/stupid then please forgive me.
I have something driving me crazy. What I'm trying to do is check whether a variable is populated or not and if so set a boolean to true and vice versa.
Code:
if ($username != "") {
$auth = true;
} else {
$auth = false;
}
Seems easy enough. I works when I print it to the screen. When I'm logged it $auth returns 1 and 0 when I'm not.
What I don't get is that I'm then trying to use the $auth variable to determine if a link should be printed around a calendar date or not. This is not working and it's driving me nuts.
Code:
if ($auth)
$str .= "<a href=\"javascript: postMessage($day, $month, $year)\">$day</a>";
else
$str .= "$day";
Again, seems easy enough, but all I ever get is the blank number ($day) even if the $auth variable is set to true.
I'm hoping this is just a quick syntax or code problem. Any help on this would be greatly appreciated.
Thanks.