Page 1 of 1

stripping html tags

Posted: Fri Nov 14, 2003 6:34 am
by chaza
I am trying to edit a txt file that I have written previously.
the writing script uses the nl2br() function to add a <br />
When I read the file into a textarea to edit it, it displays all the <br /> tags.
How can I get rid of the line break tags when it displays for editing?
I have played around with strip_tags() with no success.

Posted: Fri Nov 14, 2003 6:39 am
by twigletmac
You shouldn't use nl2br() before writing the text to file - only when you're formatting the text for display (other than editing).

To remove those <br />'s use [php_man]str_replace[/php_man]():

Code: Select all

$text = str_replace('<br />', '', $text);
but change your script so in the future you don't use nl2br() in the writing script only in the final display script.

Mac