【问题标题】:PHP text-field paragraphsPHP 文本字段段落
【发布时间】:2014-11-18 18:18:27
【问题描述】:

是否可以在“文本字段 PHP”中包含段落,即使用 shift-enter 键入内容并作为段落提交,然后在帖子中各自的段落中显示....

任何建议都将不胜感激。

您好,脚本是文本字段而不是文本区域。

也是smarty php

【问题讨论】:

  • 你有没有尝试过?你的 PHP 代码是什么?
  • 您好,脚本是文本字段而不是文本区域。它也是smarty php

标签: php textfield


【解决方案1】:
<?php
//retrieve the textarea value, assuming the form has a textarea named "textfield"
$text = $_REQUEST['textfield'];

//sanitize the text for showing it to the user
$sanitized_text = html_entities($text);

//replacing the new lines from text to <br>
$final_text = nl2br($sanitized_text);

//showing the text to the user, with "paragraphs"
echo '<p>'.$final_text.'</p>';
?>

【讨论】:

  • 您好,这不是文本区域,这是问题所在,是文本字段
猜你喜欢
  • 2021-03-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多