使用表格我將3個文本字段和2個複選框的信息插入到MySQL數據庫中。使用PHP/HTML表格將信息插入到2個MySQL表格中
數據庫由兩個表的其中包含以下行:
id - articletitle - articleorganization - articledate - articleurl
id - article_tags - articlid - tagid
的複選框使用一個數組,因而被編碼:
<input type="checkbox" name="articletags[]" value="geology" id="articletags_0" />
<input type="checkbox" name="articletags[]" value="astronomy" id="articletags_1" />
和MySQL語句如下所示:
mysql_query("INSERT INTO articles SET articletitle='$articletitle',
articleorganization='$articleorganization',
articledate='$articledate',
articleurl='$articleurl' ")
mysql_query2("INSERT INTO articles_tags SET articletags='$articletags' ")
但是,當我在網頁瀏覽器中訪問該頁面時,它顯示一個空白頁面。
如果有人想知道,我使用複選框的原因是因爲這些文章需要用標籤組合來標記,這將確保標籤中使用一致性。另外,我有一個用於編輯文章的表單,我相信可以使用數據庫結構在編輯頁面上「複選」複選框。
任何意見非常感謝。
在php.ini中啓用錯誤報告http://php.net/manual/en/function.error-reporting.php,它會打印錯誤 – maxjackie