Some friends may find us after submitting the html to php for processing and saving the data to mysql. When reading data from mysql again, there will be a lot of spaces. So if we check it directly in mysql and there is no space, what is the problem and how to deal with it.
Solution to the problem that there are always a lot of spaces in textarea
Problem description:
When reading mysql data into textarea in php, there are always many spaces at the beginning and end. When viewing the data in the data table, there are no spaces.
Cause of the problem:
The content should be written against the textarea, and there should be no spaces or line breaks after the textarea.
Solution:
The code is as follows:
The code is as follows:
Or use
The code is as follows:
Supplement:
The newline character in php textarea is "rn"
Not 'n'
Not "
"
Not 'rn'
Not 'r'+'n'
I hope this article will be helpful to everyone’s PHP programming design.