Re: [請益] 再次請教關於限制存取頁面及換行
※ 引述《yilenwu ( )》之銘言:
: $insertSQL = sprintf("INSERT INTO epdata (ep_title, ep_content, ep_date) VALUES (%s, %s, %s)",
: GetSQLValueString($_POST['ep_title'], "text"),
: GetSQLValueString($_POST['ep_content'], "text"),
: GetSQLValueString($_POST['ep_date'], "date"));
: <?php echo nl2br($_POST['ep_content']) ?>
: 改成這樣也不行@@
: $insertSQL = sprintf("INSERT INTO epdata (ep_title, ep_content, ep_date) VALUES (%s, %s, %s)",
: GetSQLValueString($_POST['ep_title'], "text"),
: <?php echo nl2br($_POST['ep_content'], "text") ?>,
: GetSQLValueString($_POST['ep_date'], "date"));
: 請問應該要怎樣改才對呢
: 我好像沒什麼慧根 對不起><
nl2br 的用途,是要將從資料庫取出來的資料內容,把原本填form時按Enter產生的換行
替換成 <br /> 以便顯示在網頁上
因此你的 form 資料在存入資料庫時,不需要使用 nl2br 對送出的資料做任何處理
所以你只要在網頁呈現時,將資料庫讀出的文字以 nlb2r 處理過即可
但是如果你的文字是要秀在 form 的 textrea 裡面,那麼就不必 nl2br
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.186.59
推
10/24 23:35, , 1F
10/24 23:35, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 7 之 7 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
125
129