tags:

views:

128

answers:

2

I allow users to put content on my website using HTML TextArea, but whenever they upload content, it doesn't contain linebreaks, even if they were to hit enter twice. How can I put linebreaks in?

A: 

If you are displaying the contents of the textarea in html you could replace linebreak characters with <br/>.

Guster_Q
i did that dont know why but it ignores the <br/> or any html tag what can i do??
eli
+1  A: 

What text editor are you using?

If you aren't using one, then you'll need to have JavaScript insert <p></p> or <br /><br /> after every time they hit 'enter'.

Of course, if users are putting content on your site, then you also need to watch any HTML they can put up, and make it so that they can't upload 'bad' HTML.

Jeff Atwood wrote one such utility for C#. You'll have to check and see if whatever language you're using on the back end supports it.

George Stocker
hii and thanks for your helpi not using any editor .and when users put there content it also puts <br/> after every line breakbut when they want to see the content but not in the editor so it shows with no line breaksi dont know why it happens .i dont know why but it ignores the <br/> or any html tagwhat can i do??
eli
What site are you referring to? Can you post the code that does the POST of the TextArea code?
George Stocker