[英]Textarea doesn't count new lines in PHP
I have a textarea
that takes some strings that user gave it and post it to another PHP file to save in into DB. 我有一个
textarea
,它接受用户提供的一些字符串,并将其发布到另一个PHP文件中,以保存到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. 该过程完全正常,但是当我从数据库中提取用户在
textarea
键入的内容时,该textarea
将显示,而用户之前在textarea
中没有输入/输入。
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? 我该如何解决它无法在Chrome或Firefox上运行的问题?
您可以像下面这样使用函数nl2br() :
echo nl2br("hi guys my name is");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.