Page 1 of 1

HTML values in DB - how to display

Posted: Thu Jun 12, 2008 9:18 am
by crazytopu
Say you have the following sentence in your database and you display that in your site using php

Code: Select all

<strong> Welcome John </strong> 
You see the sentence "Welcome " in bold.

Now my question is how do you print the above sentence when it's in the following format (in your DB):

Code: Select all

<strong>Welcome</strong>
Which is nothing but just that the <strong> and </strong> tags have been translated to their corresponding html code.

I tried to print it and all it came up on the screen is

Code: Select all

<strong> I know you </strong>
Is there any php function that I can use to display any such html values stroed in the DB that actually makes the sentence bold. I am assuming any such function will translate all such html values stored in the DB to be output on the screen.

I have used a few functions but none seemed to work.

Re: HTML values in DB - how to display

Posted: Thu Jun 12, 2008 9:24 am
by nowaydown1
Have you tried html_entity_decode? (http://us.php.net/manual/en/function.ht ... decode.php)

Re: HTML values in DB - how to display

Posted: Thu Jun 12, 2008 9:33 am
by crazytopu
Yes I did, doesnot seem to work for me.

Re: HTML values in DB - how to display

Posted: Thu Jun 12, 2008 9:36 am
by crazytopu
It just worked now. Not sure why it didnot work before. Thank you so much. :D