将来自MySQL的信息放入文本区域,不要使用额外的空格


Put the information from MySQL into the textarea, without extra spaces?

我的代码给了我一个问题:当我将信息保存到数据库中时,格式被保留,但是当我将信息放入文本区域时,有很多额外的空格。

Screenshoot: http://i1226.photobucket.com/albums/ee416/realodix/Photo%20Blog/description_zps8f9c858c.jpg

<?php
    $id = $_GET['id'];
?>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="wbpl_add-edit.php?action=updateproduct&id=<?php echo $id ?>">
    <td>
    <table>
<?php
    $sql="select * from wbpl_product
          where kd_product='$id'";
    $result=mysql_query($sql) or die(mysql_error());
    while($rows=mysql_fetch_array($result)){
    ?>
<tr>
<td width="120">Deskription</td>
<td width="350">
    <textarea name="product_deskripsi" rows="5" style="width: 512px;"><?php echo htmlspecialchars($rows['deskripsi']);?></textarea>
</td>
</tr>
<?php } ?>
<tr>
    <td>&nbsp;</td>
    <td>
    <input class="btn" type="submit" name="tambah" value="Update" />
    </td>
</tr>
<tr>
    <td colspan='2'><div id="form1_errorloc" style="color:red"></div></td>
</tr>
</table></td>
</form>

每次保存该表单时,<textarea>后的空白将添加到值之前,删除<textarea>后的空白,如下所示:

<textarea name="product_deskripsi" rows="5" style="width: 512px;"><?php echo htmlspecialchars($rows['deskripsi']);?></textarea>

试试这个:

<textarea name="product_deskripsi" rows="5" style="width: 512px;">

添加包装

<textarea name="product_deskripsi" rows="5" wrap="virtual" style="width: 512px;">

你可以使用wrap: off,软的,硬的,虚拟的或物理的