Jump to content

[SOLVED] Display HTML


johnadamson

Recommended Posts

Dear all,

 

I would like to display html from a database on a webpage, obviously as formatted. e.g.

 

The row in the database is

 

<p>This is some&nbsp;<b>bold</b> text and some <i>italic</i> text.</p>

 

But when I try and print this onto my page is displays

 

<p>This is some <b>bold</b> text and some <i>italic</i> text.</p>

 

Does anyone know how I can display the formatted text as This is some bold text and some italic text.

 

Hope you can help.

 

Link to comment
https://forums.phpfreaks.com/topic/76236-solved-display-html/
Share on other sites

pocobueno1388 that worked an absolute treat!! FANTASTIC!! Thanks for all your help.

 

revraz I tried using ECHO or PRINT originally because I thought that would work, but just got

<p>This is some <b>bold</b> text and some <i>italic</i> text.</p>

 

Thanks for your replies.

Link to comment
https://forums.phpfreaks.com/topic/76236-solved-display-html/#findComment-385869
Share on other sites

Interesting, I've never had an issue myself doing it with Echo's.

 

pocobueno1388 that worked an absolute treat!! FANTASTIC!! Thanks for all your help.

 

revraz I tried using ECHO or PRINT originally because I thought that would work, but just got

<p>This is some <b>bold</b> text and some <i>italic</i> text.</p>

 

Thanks for your replies.

Link to comment
https://forums.phpfreaks.com/topic/76236-solved-display-html/#findComment-385874
Share on other sites

Interesting, I've never had an issue myself doing it with Echo's.

 

pocobueno1388 that worked an absolute treat!! FANTASTIC!! Thanks for all your help.

 

revraz I tried using ECHO or PRINT originally because I thought that would work, but just got

<p>This is some <b>bold</b> text and some <i>italic</i> text.</p>

 

Thanks for your replies.

 

It's because they change the HTML to entities before inserting the information into the database. So when they printed it to the screen straight out of the database, it was still in entity form. So all they had to do was use the function I showed them to decode the entities back to HTML tags.

Link to comment
https://forums.phpfreaks.com/topic/76236-solved-display-html/#findComment-385878
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.