• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

displaying new line characters

I am taking information on a form using text areas, when i output this information the new line characters are not being displayed, how do i display this information exactly as it is inputted?
  • 2
1 Solution
Richard QuadlingSenior Software DeveloperCommented:
Do a view-source on the current rendered page. If you see the line breaks in the source, then in your code, wrap the text with nl2br();

Richard QuadlingSenior Software DeveloperCommented:
If you don't see the line breaks, the data is being saved or submitted without them. What attributes on the textarea do you have set?

wrap="off" is what I would recommend.

<TEXTAREA WRAP = sWrap ... > 

sWrap = String that specifies one of the following values:

soft - Text is displayed with wordwrapping and submitted without carriage returns and line feeds.
hard - Text is displayed with wordwrapping and submitted with soft returns and line feeds.
off - Wordwrapping is disabled. The lines appear exactly as the user types them.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now