
|
 |

Converting ASCII line returns to HTML line breaksIf your webpage is displaying text from a database or HTML form where the text may contain carriage returns, your carriage returns won't be displayed in a HTML page. Consequently, all your paragraphs will be merged into a single paragraph. You need to convert all ASCII line breaks into HTML link breaks using the in-built PHP function nl2br():
<?php
$textdata = "here is
a bit of text
to break into separate lines";
echo nl2br( $textdata );
?>
|
|
|