Subject: Where did my Hard Returns go?

From: Date: Wed, 01 Mar 2006 18:08:22 +0000
Subject: Subject: Where did my Hard Returns go?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41356@lists.php.net to get a copy of this message
At 14:00 01/03/2006, you wrote:
Message-ID: <001701c63d38$71e84c30$6501a8c0@shuttlebox> From: "Jeff Broomall" <news@broomall.us> To: <php-db@lists.php.net> Date: Wed, 1 Mar 2006 09:00:03 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_0014_01C63D0E.87271600"
Subject: Where did my Hard Returns go? I created an edit_task page that allows the user to edit tasks for the database. I entered some text and used some hard returns. But when I went to view the tasks (using a PHP script if it matters), the hard returns didn't "take." None of em. All of the text is jumbled together. I checked within the MySQL database and noticed the Hard Returns show in the database (at least while using phpMyAdmin). Must have something to do with PHP? Where did I go wrong???
No, it must not have something to do with PHP. View the source of your web page. You'll see those hard returns are recovered verbatim from the database. Web browsers *only* respect returns (newlines) in elements formatted as <pre /> or when using a fixed pitch font in CSS. You need to nl2br($result_string) if you want to get HTML <br /> characters in the stream - browsers use <br /> not newlines to display line breaks. I thought everybody knew that ;-)) Cheers - Neil

« previous php.db (#41356) next »