| 
 Posted by Guido Winkelmann on 09/09/05 02:02 
monomaniac21 wrote: 
 
> Hi i'm trying to write a piece of code which writes the message on 
> screen "access denied" telling the user he can't access this page 
> without logging in and then offering a hyperlink to the login page. 
>  
> Like this: 
>  
> if ($queryrows) 
> { 
> echo("Welcome to the birthdays page"); 
> } 
> else 
> { 
> echo("Access denied<br>"); 
> echo("<a href="index.php">click here to access the login page</a>"); 
> } 
[...] 
 
As R. Rajesh Jeba Anbiah already pointed out, you can use HTML directly. 
 
Another thing you should be aware of is that you cannot have "'s inside a 
string delimited by ". Your <a href="index.php"> does exactly that, causing 
PHP to think the string ends right after href=. If you need "'s inside a 
string you will either have to use another delimiter (like ') or escape 
them with backslashes like this: 
echo("<a href=\"index.php\">click here to access the login page</a>"); 
 
        Guido
 
  
Navigation:
[Reply to this message] 
 |