Hi Everyone,

I have made my own forums/site which is working out quite well. The only problem I'm having is when people edit there topic or if I edit the news.

The current topic or news is loaded into a textarea including all the line breaks which were instered via the nl2br() function.

When these line brakes (<br />) are loaded into the textarea i done want people to see them and so i use the

str_replace("<br />", "\n", $content);

and it does do what i want it to do but it seems to double the line breaks every time you edit some content.

Please help and thanks in advance!

Daniel

Recommended Answers

All 4 Replies

What is the post stored as in the database? If it's stored as "text" and not varchar() then I believe you don't need the <br /> tags as line breaks are automatically placed which may be why your line breaks are doubling.

it's stored as longtext bud, thanks for replying =)

Nevermind mate your right, i fixed it thanks alot!

You're welcome. Please mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.