galvin Posted November 15, 2011 Share Posted November 15, 2011 Say I have the following text stored in a MySQL database... <b>Classic Quote from movie</b> and I retrieve it into a variable called $text, how do I properly echo that so that it keeps the bold tags and actually display the text "Classic quote from movie" in BOLD? I'm doing something wrong somewhere along the line (simply doing "echo $text;") because it displays on the page as... <b>Classic Quote from movie</b> Instead of... Classic Quote from movie Any info on properly storing and echoing back HTML would be very appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/251210-echoing-back-html-tags-from-mysql-database-to-respect-html-tags/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 15, 2011 Share Posted November 15, 2011 There's nothing specific to storing/retrieving data or php that would prevent what you are doing from working. You likely have some code that is using htmlentities or htmlspecialchars on the data, which converts the < and > into html entities and they are not rendered by the browser. What does a 'view source' in your browser of the non-working <b>Classic Quote from movie</b> show? Quote Link to comment https://forums.phpfreaks.com/topic/251210-echoing-back-html-tags-from-mysql-database-to-respect-html-tags/#findComment-1288453 Share on other sites More sharing options...
galvin Posted November 15, 2011 Author Share Posted November 15, 2011 Thanks, after some tinkering I got it to do the bold properly. Not really sure what I did wrong at first, but it's working as I expected now. At one point, the code was getting echoed back into an h2 tag, so EVERYTHING was bold and that was throwing me off as well :-\ Also, i noticed these strange characters in the MySQL table where the stuff is stored. I assumed this is normal and just how MySQL stores it. If this is bad for some reason, please let me know <p>Prove you’re a loyal member of the team and “the league†Anyway, thanks for answering! Quote Link to comment https://forums.phpfreaks.com/topic/251210-echoing-back-html-tags-from-mysql-database-to-respect-html-tags/#findComment-1288457 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.