SQL - Text Area stored into longtext then outputted doesn't keep carriage returns

Al Neri

Diamond Member
Jan 12, 2002
5,680
1
81
What's up,

Okay, I am making a guestbook like system with PHP and MySQL

The comment section of the form uses a Text Area which is stored into longtext in my database. In the database all the carriage returns are in tact, however when I output the text as a <p> the carriage returns are lost and for example:

Hello

What's up
How are you

becomes:

HelloWhat's upHoware you



is there any way to add in carriage returns when outputting longtext?

Thanks,
Don
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Which character is serving as a carriage return? If it's the ascii line feed/new line character (0x0d/0x0a) then it is meaningless and unrenderable in HTML. HTML uses the br element to specify a line break.

Look at the text coming out of the textarea when you enter hard returns. If it is inserting br then you must have code that is stripping it back out, or there is some other problem with the formatting.