0

I am pulling data from a table in my database and inserting it into a form - therefore I can edit it and save it back to the table.

My current problem is my data in the table has HTML characters like

<br /><br />

which as we all know are line breaks - I don't want them to display like html characters though... In the textarea where I have outputted them to I would like them to just display as line breaks within the text area...

I have tried using htmlentities and htmlspecialchars with no luck.

4

2 回答 2

0

如果您只想转换换行符,请使用 phps nl2br() 函数。

让 textarea 呈现 html 标记的方法:这行不通。它根本不受支持。textarea 标签支持文本,而不是标记。那是不同的东西。您要么必须坚持使用纯文本,要么使用基于 js 的所见即所得编辑器之一。

于 2012-09-28T02:48:53.837 回答
0

我想你知道如何从 mysql 表中获取这些数据,所以我将跳过它,只需添加以下内容:-

<textarea cols="20" rows="20" >
<?
echo "$name\n\n";
echo "$age";
?>
</textarea>
于 2012-09-28T02:49:11.543 回答