We help IT Professionals succeed at work.

displaying new line characters

markmchugh
markmchugh asked
on
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?
Comment
Watch Question

Senior Software Developer
BRONZE EXPERT
Commented:
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 Developer
BRONZE EXPERT

Commented:
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.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.