Page 1 of 1

[SOLVED] Displaying HTML code in <textarea>

Posted: Tue Mar 29, 2005 10:01 pm
by voltrader
I'm in process of writing my admin module and I would like to be able to enter strings of HTML code, which are then stored in the database.

For some reason, when I retrieve the code, and addslashes to them, they seem to get truncated.

HTML is stored in the db as so:

Code: Select all

\<a href='http://www.domain.net/click-1647300-10382409' target='_top' >
<b>some stuff</b>
</a>
<img src='http://www.domain.com/image-1647300-10382409' width='1' height='1' border='0'\>
When I retrieve it from the db using adslashes, I see this in the textarea:

<b>some stuff</b></a><img src='http://www.domain.com/image-1647300-10382409' width='1' height='1' border='0'\>'>

I'm missing the initial anchor. Any ideas what I'm doing wrong?

Posted: Tue Mar 29, 2005 10:25 pm
by feyd
how are you attaching the html to the textarea? I just use htmlentities().

Posted: Tue Mar 29, 2005 10:31 pm
by voltrader
Ahhh - thanks. You solved my problem with that question!

I was attaching the html code in <textarea value='code'> rather than putting the code inbetween the tags.

:P