Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
MySQL varchar and linebreak only works on textarea

I've got a DB entry with a varchar field with the following text saved:

This is a line
new line here
and another line here

I can only see those line breaks if I print it within textarea. How can I make the line break work outside of textarea?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

A sequence of multiple white space characters is collapsed by default in HTML, except in some elements like textarea inner text like you noticed. You have a few options:

  • Process your text to convert newlines to <br> tags (see nl2br())
  • Echo it to an element which preserve line breaks, such as an styled <pre>
  • Use CSS to set the white-space of your element to pre, pre-line or pre-wrap which will respect line breaks
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!