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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.