Well, this is the way I'd do it . . .
<a href="<?php
if($auth["perms"])
{
echo $sess->purl(URL . "?page=$modulename/index&func=userLogout");
$str_linkdesc = "Logout";
}
else
{
echo $sess->purl(SECUREURL . "?login=1&$QUERY_STRING");
$str_linkdesc = "Login";
}
?>" class="Menu"><?=$str_linkdesc?></a>
My general strategy is to use echo/print as little as possible for outputting HTML. I'm not sure why you want the code in the echo statement, but that's your choice.
In any case, if this is a exact copy/paste of your code, I see a couple of problems:
In your echo statements, you aren't escaping the double quotes. You want it to look like this:
<?php
echo "<a href=\"somelink.php\" class=\"someclass\">Click Me!</a>\n";
?>
If you don't include the "\" before the double quotes that you want PHP to output, then it will think that the first double quote it runs into (after the initial double quote after the echo statement) is the end of the string, and hence will start to look for a concatenation operator or a semicolon marking the end of the line.
- echo ">class="Menu" Logout";
Here you've got no ">" closing your A tag.
- echo "class="Menu" "> Login";
Here you've got an extra double quote.
Either one of these will probably flumox the web browser.