2011-02-11 130 views
2

在CodeIgniter應用程序中,我有一個用於內容輸入的textarea。我想保留新行,但是我遇到了這樣的問題,即保存數據時,會在每行都添加一行新行,然後在我下次編輯時顯示在textarea中。PHP textarea將額外的新行保存到MySQL數據庫

如何擺脫這個額外的新行,最好在數據保存之前?

mysql_real_escape_string示出了數據如下:

這是第一線\r\n\n這是第二線\r\n\n這是第三線

哪個顯示textarea的像這樣:

this is the first line 

this is the second line 

this is the third line 

我只是想要這個:

this is the first line 
this is the second line 
this is the third line 
+0

你必須要麼等待一些CI大師或自己調試它。我建議後者。 – 2011-02-11 10:26:13

+0

請顯示`var_dump($ _POST ['text'])的輸出' – xzyfer 2011-02-11 10:57:31

回答