-1

I'm storing description data from textrea field to database. The problem is when i write a long line text without line breaks it's storing the same to database. I need to prevent line breaks depends on textarea width... example

and output is going out from container... enter image description here

Qirel
  • 25,449
  • 7
  • 45
  • 62
pwnz22
  • 469
  • 2
  • 9
  • 19

1 Answers1

3

If I understand your problem correctly, it's that the output breaks the div you're putting it in - that makes it a CSS issue, not a PHP one.

You can use the word-wrap: break-word; CSS attribute, which will break the words if they exceed the width of the container.

.break {
    word-wrap: break-word;
    width: 100px;
    background: lightgray;
}
<div class="break">
      Thisisaverylongstringexceedingthewidthofthecontainer
</div>
Qirel
  • 25,449
  • 7
  • 45
  • 62