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.
stripping html tags
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
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]():
but change your script so in the future you don't use nl2br() in the writing script only in the final display script.
Mac
To remove those <br />'s use [php_man]str_replace[/php_man]():
Code: Select all
$text = str_replace('<br />', '', $text);Mac