INeedAGig Posted May 14, 2012 Share Posted May 14, 2012 Hey there guys, small problem here that I can't seem to figure out. I am in the process of programming a database with user-access control. I have the log-in system working great, but the logout link, which is located next to the logged-in username seems to not be echoing correctly. It is loading the 'Logout' text in text-form only, not link-form.... Any ideas on what may be causing this small glitch?? Thanks!! I have attached relevant code for said part for reference. <img src="images/username.png" height="20" width="20"> <b>Welcome</b> <?php echo ("<font color=#9e0219>$username</font>");?>, <?php echo '<a href="logout.php">Logout</a>';?> Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/ Share on other sites More sharing options...
Pikachu2000 Posted May 14, 2012 Share Posted May 14, 2012 Echoes a link for me when I copy and paste it into my editor and call the script in my browser. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345344 Share on other sites More sharing options...
INeedAGig Posted May 14, 2012 Author Share Posted May 14, 2012 Hmm...Odd.... That's the thing...it WAS working for me, but all of a sudden doesn't.... Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345345 Share on other sites More sharing options...
PFMaBiSmAd Posted May 14, 2012 Share Posted May 14, 2012 Works for me too. The Snippet of posted code is probably inside of some other broken html or possibly has some css that renders it impotent. Edit: Any chance that username being displayed contains some html special characters? Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345346 Share on other sites More sharing options...
INeedAGig Posted May 14, 2012 Author Share Posted May 14, 2012 The username being echoed does contain an underscore. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345349 Share on other sites More sharing options...
PFMaBiSmAd Posted May 14, 2012 Share Posted May 14, 2012 That's not a html special character. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345353 Share on other sites More sharing options...
INeedAGig Posted May 14, 2012 Author Share Posted May 14, 2012 Alrighty, tested a bit more, it only occurs when it is within its containing div, if it is outside of it's div, it works just fine.... What could be causing this? Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345356 Share on other sites More sharing options...
INeedAGig Posted May 14, 2012 Author Share Posted May 14, 2012 Still cant seem to figure this out...any ideas? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345457 Share on other sites More sharing options...
batwimp Posted May 14, 2012 Share Posted May 14, 2012 Could you post the code that includes the containing divs a few levels up? Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345460 Share on other sites More sharing options...
jason310771 Posted May 14, 2012 Share Posted May 14, 2012 try the following... <img src="images/username.png" height="20" width="20"> <b>Welcome</b> <?php echo('<font color="#9e0219">'.$username.'</font>');?>, <?php echo('<a href="logout.php">Logout</a>');?> Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345474 Share on other sites More sharing options...
rythemton Posted May 15, 2012 Share Posted May 15, 2012 We definitely need more code to work with. The problem is most likely somewhere else in the page. Do you have another anchor tag (<a>) that isn't closed? Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345496 Share on other sites More sharing options...
Pikachu2000 Posted May 15, 2012 Share Posted May 15, 2012 Since this seems to be more of an HTML/CSS problem, you should probably post the html source, as in when you do a View --> Source in your browser. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345512 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Hey there guys, small problem here that I can't seem to figure out. I am in the process of programming a database with user-access control. I have the log-in system working great, but the logout link, which is located next to the logged-in username seems to not be echoing correctly. It is loading the 'Logout' text in text-form only, not link-form.... Any ideas on what may be causing this small glitch?? Thanks!! I have attached relevant code for said part for reference. <img src="images/username.png" height="20" width="20"> <b>Welcome</b> <?php echo ("<font color=#9e0219>$username</font>");?>, <?php echo '<a href="logout.php">Logout</a>';?> Just to confirm, the "Logout" text is no clickable at all? It's not something silly like that container <div> has text-decoration:none or something like that, correct? Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345610 Share on other sites More sharing options...
Drummin Posted May 15, 2012 Share Posted May 15, 2012 Hows it work with full quotes? <img src="images/username.png" height="20" width="20"> <b>Welcome</b> <?php echo "<span style=\"color=#9e0219;\">$username</span>"; ?>, <?php echo "<a href=\"logout.php\">Logout</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345625 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Hows it work with full quotes? <img src="images/username.png" height="20" width="20"> <b>Welcome</b> <?php echo "<span style=\"color=#9e0219;\">$username</span>"; ?>, <?php echo "<a href=\"logout.php\">Logout</a>"; ?> That's not valid inline CSS. See color=#9e0219 should be color:#9e0219 His initial code was OK. HTML without quotes is still valid HTML. It only becomes invalid when you have declared your document as XHTML, but who does that anymore? Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345630 Share on other sites More sharing options...
Drummin Posted May 15, 2012 Share Posted May 15, 2012 Yes an obvious over site on my part when making the conversion. However <font> is an old depreciated coding style. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345633 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Yes an obvious over site on my part when making the conversion. However <font> is an old depreciated coding style. You're right, it is. But there is more to this than his current HTML markup. That's why I asked him to simply see if the 'Logout' text was in fact clickable as I fear, and have seen a million times before in similar cases, that the containing DIV simply has a text-decoration:none style attached to it for all hyperlinks. Might not be the case, but it needs to be ruled out for my sanity. Aside from that, I fail to see how a DIV could otherwise manipulate the content within and break links without it being controlled by javascript. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345640 Share on other sites More sharing options...
Drummin Posted May 15, 2012 Share Posted May 15, 2012 Yes an obvious over site on my part when making the conversion. However <font> is an old depreciated coding style. You're right, it is. But there is more to this than his current HTML markup. That's why I asked him to simply see if the 'Logout' text was in fact clickable as I fear, and have seen a million times before in similar cases, that the containing DIV simply has a text-decoration:none style attached to it for all hyperlinks. Might not be the case, but it needs to be ruled out for my sanity. Aside from that, I fail to see how a DIV could otherwise manipulate the content within and break links without it being controlled by javascript. I agree. It must be the css for the containing div or its parent that causing the problem. Showing relevant code, div/wrappers etc and css would shed some light on the problem. Quote Link to comment https://forums.phpfreaks.com/topic/262518-echoed-logout-link-not-working/#findComment-1345644 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.