MY script bug : displaying data from db to a textarea

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Zoram
Forum Contributor
Posts: 166
Joined: Sun Aug 18, 2002 3:28 pm
Location: Utah
Contact:

MY script bug : displaying data from db to a textarea

Post by Zoram »

When i am editing fields from a database in a text area and the field has a </textarea> tag in it it kills the texarea it's suppose to be in and start writing to the page.

Is there a way to make a text area so that it displays whatever is in the db stays in the textarea?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You could use htmlspecialchars() to make any HTML in the output from the database display as entities such as < and >. Or you could use str_replace() to replace the problem tag(s) with something else. It all depends on what you want the output to look like.

Mac
Post Reply