PHP submits textarea data to MySQL with a number of whitespace solutions, textareamysql
This example explains how PHP submits textarea data to MySQL with a lot of whitespace. Share to everyone for your reference. The specific analysis is as follows:
Some friends might find that we have a lot of space when we read the data from MySQL again after HTML is submitted to PHP for processing the data into MySQL, so if we look at MySQL directly and there is no space, what is the problem?
There are always a lot of whitespace problems in textarea solution
Problem Description:
In PHP read MySQL data to textarea beginning can end there are a lot of spaces, in the data table to see the data there is no space.
Cause of the problem:
The content should be written with textarea, and do not have spaces and line breaks after textarea.
Workaround:
The code is as follows:
Copy the Code code as follows: <?php
Echo str_replace (', ', ' ab AB ');
Output "Abab"
?>
or use
Copy the Code code as follows: <?php
echo strtr (' Ab ab ', array (' ' = ') ');
Output "Abab"
?>
Add:
The line break in PHP textarea is "\ r \ n"
Not ' \ n '
Not
"
Not ' \ r \ n '
Not ' \ r ' + ' \ n '
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/930186.html www.bkjia.com true http://www.bkjia.com/PHPjc/930186.html techarticle PHP will textarea data submitted to MySQL a lot of space to solve the problem, textareamysql This article describes the PHP textarea data submitted to MySQL a lot of space to solve the problem. Share to ...