1,105,208 Community Members

Replace line breaks with <br />?

Member Avatar
GlenRogers
Posting Whiz
329 posts since Jan 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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
webpage

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

Member Avatar
urtrivedi
Posting Virtuoso
1,897 posts since Dec 2008
Reputation Points: 249 [?]
Q&As Helped to Solve: 409 [?]
Skill Endorsements: 27 [?]
 
0
 

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

Member Avatar
GlenRogers
Posting Whiz
329 posts since Jan 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Ahhhhhhhhhhhhh thats it!

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

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