简体   繁体   English

如何在使用 GET 方法发送 url 时保留 textarea 输入中的文本段落?

[英]How can I preserve the text paragraphs from a textarea input while sending in url with GET method?

I am using GET to send text from textarea element.我正在使用 GET 从 textarea 元素发送文本。 When I enter two or more paragraphs, the formatting is gone and paragraphs got merged as single paragraph.当我输入两个或更多段落时,格式消失了,段落被合并为单个段落。

Or suggest any other way to send larger texts (about 200 plus) words through request.或者建议任何其他方式通过请求发送更大的文本(大约 200 多个)单词。

Use this,用这个,

$comments = stripslashes(trim($_GET['data']));, you can use $_POST as well

<textarea><?= nl2br($comments); ?></textarea>

you can use the same while storing and use nl2br() while displaying.您可以在存储时使用相同的内容,并在显示时使用nl2br()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM