[英]Put the information from MySQL into the textarea, without extra spaces?
我的代碼給了我一個問題:當我將信息保存到數據庫中時,格式化被保留,但是當我將信息放入textarea時,會有很多額外的空格。
屏幕截圖: 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> </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,soft,hard,virtual或physical
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.