0

I have a textarea that takes some strings that user gave it and post it to another PHP file to save in into DB.

The process works completely fine but when I extract what user typed in the textarea from my DB the text shows without the enters / breaks that user give in the textarea before.

For example, if the user writes:

'hi guys 
my name is '

it shows when i extract it like this:

'hi guys my name is' 

Where is the enter that I put in first place?

How can I fix this it doesn't work on either Chrome or Firefox?

techraf
  • 64,883
  • 27
  • 193
  • 198

1 Answers1

0

You can use function nl2br() like below:

echo nl2br("hi guys my name is");
Suresh Kamrushi
  • 15,627
  • 13
  • 75
  • 90