Hi guys,
I have a quick question. I have a form which, when submitted, enters the data into a field in a mySQL database of type text.
When I retrieve the information/text from the database, I need to be able to detect carriage returns and convert them to display a properly formatted piece of text in HTML with either <br> or <p> for every carriage return.
How would I do this?
Thanks.
carriage return 'retrieval' from mySQL database
Moderator: General Moderators
Try using str_replace to insert a paragraph tag. It works for me.
Code: Select all
$htmlText = str_replace("\n", "<p>", "$yourQueryTextField");