Page 1 of 1

textarea addslashes confusion

Posted: Wed Aug 30, 2006 8:48 am
by jmut
Hi,
I really think the function

Code: Select all

addslashes()
is practically of no use in php...but.

How do you show text in html textarea tag?
What if there are quotes in the text?. What if you want to show hrefs(links) but not allow other html and the page break.

Posted: Wed Aug 30, 2006 11:26 am
by Jenk

Code: Select all

echo '<textarea>' . htmlentities($text) . '</textarea>';

Posted: Wed Aug 30, 2006 11:45 am
by Supper Baby
use stripcslashes() before showing the contint.
be sure befor using add and strip slahes, the get_magic_quotes_gpc() value is zero

if it's zero then use them.

Posted: Wed Aug 30, 2006 8:45 pm
by RobertGonzalez
Start first by echoing some of the data to make sure it is not what you want to see. Then take a look at ways to change it into what you want to see. If there is HTML in the data, use the functions that were mentioned previously.