The carriage return of the text submitted by the form textarea is converted to the text submitted in the textarea of the & lt; p & gt; form. after the text is submitted, it is written to the mysql database, then read and display it. The result shows that the carriage return is missing. There are many sections, and the results are combined into a large segment. Is there any way to convert the carriage return of the text submitted by textarea in the form text
The text submitted in the form textarea is written to the mysql database and then read and displayed. The result shows that the carriage return is missing. There are many sections, and the results are combined into a large segment.
Is there any way to convert the carriage return submitted in the form textarea into an image?
What about this html tag? What is the conversion before writing data to the database? Or can it be converted after being read from the database?
Can you give me a specific code? Share To:] The text submitted in the form textarea is written to the mysql database after submission, and then read and displayed. The result shows that the carriage return is missing. There are many sections, and the results are combined into a large segment. Is there any way to put the tex... 'data-pics = ''>
------ Solution --------------------
Echo nl2br ($ arr [txt]);
------ Solution --------------------
$ Arr ['txt '] = nl2br ($ arr ['txt']);
Str_replace (char (13 )),"
", $ Arr [txt]);
Yes, because php does not have the char Function and only has the chr function.
However, it is inappropriate to write chr (13), because the linux text does not have this "carriage return" character, so if you write it yourself, you should write it.
$ Arr ['txt '] = preg_replace ("/[\ r \ n] + /","
", $ Arr ['txt ']);