Reputation: 119
I have text fields which are populated from a database, the text when entered by the user is punctuated correctly with full stops and carriage returns etc.
Using VB with an ordinary db request:
<%=(rsMyrecordset.Fields.Item("text").Value)%>
I would get this result:
Mary had a little Lamb. Its fleece was as white as snow.
even if the user entered a return after the full stop after the word Lamb.
Using this code:
<%= Replace(rsMyRecordset.Fields.Item("text").Value, VbCrLf, "<br>") %>
The text returned would be:
Mary had a little Lamb.
Its fleece was as white as snow.
How would I achieve the same result using PHP? Currently I have:
<?php echo $row_rsMyRecordset['text']; ?>
Many thanks
Upvotes: 0
Views: 30
Reputation:
maybe you are looking for nl2br: http://php.net/manual/function.nl2br.php
<?php echo nl2br($row_rsMyRecordset['text']); ?>
Upvotes: 3