squiblo Posted August 16, 2009 Share Posted August 16, 2009 this is my effort, but its not working, what is the proper way to do this? <?php if($_SESSION['mycompany']) { echo "Welcome " . ucwords(strtolower($_SESSION['mycompany'])); ?> <a href="/login.php" style="text-decoration:none"><font color=#FFFF00> <?php } else { echo "Sign in </a></font>/ Register"; } ?> I only want "Sign In" to be linked Link to comment https://forums.phpfreaks.com/topic/170473-solved-linking-in-an-if-statment/ Share on other sites More sharing options...
asmith Posted August 16, 2009 Share Posted August 16, 2009 Can you explain more specifically? When there's a welcome message for the "company", You want to show sign in link to them? Link to comment https://forums.phpfreaks.com/topic/170473-solved-linking-in-an-if-statment/#findComment-899227 Share on other sites More sharing options...
squiblo Posted August 16, 2009 Author Share Posted August 16, 2009 "Sign In / Register" will only be echoed if im not logged in, so when "Sign In" is echoed I would like it to be linked to a page where i can sign in, but i cannot create this link. Link to comment https://forums.phpfreaks.com/topic/170473-solved-linking-in-an-if-statment/#findComment-899228 Share on other sites More sharing options...
smerny Posted August 16, 2009 Share Posted August 16, 2009 What exactly is the purpose of starting the anchor tag in a different condition? I would think this is what you'd want.. <?php if($_SESSION['mycompany']) { echo "Welcome " . ucwords(strtolower($_SESSION['mycompany'])); } else { echo "<a href='login.php' style='text-decoration:none'>Sign in </a>/ Register"; } ?> Link to comment https://forums.phpfreaks.com/topic/170473-solved-linking-in-an-if-statment/#findComment-899229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.