Jump to content

select data f rom table display as html


dzhax

Recommended Posts

Hey everyone. Have been super busy with work and gotten rusty on my coding.I am trying to store html in a sql database and then display it when requested with tags intact.Im sure its easy i just cant seem to remember how to do it.Not worried about displaying php tags for that would need ajax im just worried about html atm.Thanks again.EDIT: I dont need the uploading of text just displaying it. i originally used print tag with php it dosent seem to work tho. Unless this is right... and i screwed up somewhere.table: test2 field: content

Link to comment
Share on other sites

If you mean that you want to output the tags onto the page instead of them being interpreted by the browser as markup, you can use htmlentities() to turn tags into character set equivalents. You can specify which charset you'd like, but standard is ISO-8859-1. You can use htmentities() to transform input before writing it to the database or afterwards.

Link to comment
Share on other sites

ive done it before but lost my old code
Reminds me of the time I wrote a backup script...I accidentally overwrote it....and I didn't have a backup of it. Yeah, the Irony Meter went to 11. [........./.] Irony Meter
Link to comment
Share on other sites

If you mean that you want to output the tags onto the page instead of them being interpreted by the browser as markup, you can use htmlentities() to turn tags into character set equivalents. You can specify which charset you'd like, but standard is ISO-8859-1. You can use htmentities() to transform input before writing it to the database or afterwards.
Actaully i want to do the exact opposite. I want to eventually have a form that the user adds in html code and it is stored in the database. Then when the page is requested it gets the html from the database and displays it as if it were a standalone html doc.
Link to comment
Share on other sites

Reminds me of the time I wrote a backup script...I accidentally overwrote it....and I didn't have a backup of it. Yeah, the Irony Meter went to 11. [........./.] Irony Meter
:)
Link to comment
Share on other sites

Actaully i want to do the exact opposite. I want to eventually have a form that the user adds in html code and it is stored in the database. Then when the page is requested it gets the html from the database and displays it as if it were a standalone html doc.
you would probably want to use htmlentities() on the data on the way in, and then htmlspecialchar() on the way out.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...