开发者

html textarea showing 'mysql text/varchar' in unformatted manner

Using CGI and HTML:

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

Mysql column has value -> 'hi there'

textarea showing as

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

Post shows as ->

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

How can i get the text exactly the same as in database? Please help.

*Solution***

Funny...i changed code from:

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

To:

<textarea name=comments rows="6" cols="40" wrap="soft">$hash_ref->开发者_Python百科{'notes'}</textarea>  

And it worked :)


Can you use trim() before you echo it? It will remove leading and trailing whitespace.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜