2011-04-26 30 views
0

使用CGI和HTML:HTML textarea的表示 'MySQL的文本/ VARCHAR' 在未格式化的方式

<textarea name=comments rows="6" cols="40" wrap="soft"> 
$hash_ref->{'notes'} 
</textarea> 

Mysql的列具有值 - > '您好'

textarea的表示作爲

<lot of spaces before>hi there<lot of spaces after> 

後顯示爲 - >

comments=+%0D%0A%09+hi+there+%0D%0A%09+ 

如何獲取與數據庫中完全相同的文本?請幫忙。

*解決方案***
搞怪......我改變代碼:

<textarea name=comments rows="6" cols="40" wrap="soft"> 
    $hash_ref->{'notes'} 
    </textarea> 

要:

<textarea name=comments rows="6" cols="40" wrap="soft">$hash_ref->{'notes'}</textarea> 

和它的工作:)

回答

1

燦你在回聲之前使用trim()?它將刪除前導空白和尾隨空白。