2013-07-16 228 views
0
<?php 

session_start(); 

include_once ('../include/connection.php'); 

if (isset ($_SESSION ['logged_in'])) { 

    if (isset ($_POST ['title'], $_POST ['content'])) { 
     $title = $_POST ['title']; 
     $content = $_POST ['content']; 

     if (empty ($title) or empty ($content)) { 
      $error = 'All fields are required'; 
     } else { 

      $query = $pdo->prepare ('INSERT INTO articles (article_title, article_content, article_timestamp) VALUES (?, ?, ?)'); 

      $query->bindValue (1, $title); 
      $query->bindValue (2, $content); 
      $query->bindValue (3, time()); 

      $query->execute(); 

      header ('Location: index.php'); 
     } 
    } 
    ?> 
+4

你做了什麼錯誤? –

+1

不知道錯誤無法幫助。 – williamcarswell

+0

沒有錯誤不提交表單我現在不爲什麼 –

回答

0

請檢查你的語法 - 「}」缺少

也許這解決了這個問題