Jump to content

Text Area Removes Enter


MrFish
 Share

Recommended Posts

I have a textfield that is used to submit news content to my site. It excepts html (only the admin can use it) and I'm writing bbcode for it but when I hit the enter key to create a newline or space it doesn't save and the text will all site in one line when it is submitted.What I write-

This is a textfield.I hit enter to create a new line.I hit enter twice to create a space.

What it submits as-

This is a textfield.I hit enter to create a new line.I hit enter twice to create a space
How can I fix this?
Link to comment
Share on other sites

nl2br() in php or search the textarea and replace the newline (\r\n) with a <br />
I didn't know textareas held \r and \n information when you hit enter. Thanks :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...