Page 1 of 1

MY script bug : displaying data from db to a textarea

Posted: Sat Oct 05, 2002 3:26 am
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?

Posted: Sat Oct 05, 2002 6:51 am
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