Results 1 to 3 of 3
Help with displaying only a portion of overflow Forum: HTML ForumReplies: 4
Displaying a table in Thunderbird Forum: HTML ForumReplies: 1
need help displaying results with links Forum: PHP ForumReplies: 0
Displaying pdfs Forum: Graphics ForumReplies: 4
Tags???????????? Forum: HTML ForumReplies: 4
01-31-2002, 02:29 AM #1
Help me with displaying HTML tags
Can somebody help me with this problem... My main problem is I want to display HTML tags on a page without being interpreted by the browser as HTML tags. The text (which includes the tags) that I want to display is not hard-coded. Instead it is inserted into the database using form and displayed also in a form by retrieving it from the database.
I know that one solution to this is to replace < and > symbols with their entity references: < and >
So when inserting the text into the database, I replace all < and > with their entity references. It works when I retrieve the text from the database and display it on a page. But when I want to edit the text (the saved text is displayed in a text field in a form), it is automatically displayed with the < and > symbols, instead of the entity references. So I have to replace all the symbols again with their entity references. This is a tedious process especially when the text that I want to edit is quite long.
So can anyone help me with this problem? Any help is very much appreciated.
01-31-2002, 02:38 PM #2
Welcome to the forums!
Thats a tricky one. I know how I would handle it -
The html form is not going to display the correct code, so how about we play with whats inbetween the form and the database?
I assume you are using some kind of server-side code to insert the form contents into the database. PHP, Perl, ASP whatever.
I would set a small search and replace function in there to convert < and> to the correct code.
In php, it would be ereg_replace(). Don't know enough about the others, but I guarantee they have a similar function.
This is assuming, of course, that you have access to the server side script. If you don't, then you must be using another script to display the contents of the DB, so put the ereg in there instead.
let me know if this helps.If one of our members helps you, please click the icon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
02-02-2002, 03:28 PM #3