I’m using an textarea to send text to my DB.
Screenshot of db:

When I’m reading from the DB it removes the line breaks, how can I keep them in $row[‘opmerkingen’]?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When displaying text, use
nl2br()to convert newlines to<br/>tags, i.e., instead of<?php echo $row['text']; ?>, use<?php echo nl2br($row['text']); ?>.By default, browsers display newlines as spaces, therefore they have to be converted to
<br/>tags.For those who find this useful – please consider using
white-space: pre-line, suggested by Emil Vikström. I’m not a web guy anymore and easily can’t verify this, but Boaz says in comments that it is supported by all modern browsers. If so, that should be preferred to usingnl2br().