1.11M Members

Replace line breaks with <br />?


I have some text in a mysql table, stored as text and taken from an html <textarea>.

For example of some text.
Hi this
is Glens

When I display this on my web page it comes out as

Hi this is Gles webpage.

How do I get it to display with the newlines?

Here is the code.

while($info = mysql_fetch_array( $data )) { 
                          $date = $info["date"];
                          $date = strftime("%b %d, 20%y", strtotime($date));  

                          echo "<span class='span2'>";
                          echo "<p>";
                          echo $info['title'];
                          echo "......".$date;
                          echo $info['content'];
                          echo "</p>";
                          echo "</span>";
                          echo "<br />";

Thanks for looking.................


echo nl2br($info['content']);


Ahhhhhhhhhhhhh thats it!

Many thanks.................

Question Answered as of 1 Year Ago by urtrivedi
This question has already been solved: Start a new discussion instead
Start New Discussion
Tags Related to this Article