I have got a problem. This is my code for editing the article. I dont know why, but my UPDATE is not working. It just redirect to ../index.php. I've tried everything( Quotation mark and stuff too..).. Can u help me ? I just want to edit/update title and content. Code is below. Thanks so much.
editarticle.php
<?php
session_start();
include_once('../connect.php');
include_once('../includes/article.php');
header('Content-type: text/html; charset=utf-8');
if(isset($_SESSION["user_id"])){
 $query=$pdo->prepare("SELECT * FROM users WHERE id = " 
 .$_SESSION["user_id"] );
  $query->execute();
  $row=$query->fetch(PDO::FETCH_ASSOC);
  if($row['privileges']==1){
   $query = $pdo->prepare("SELECT * FROM `articles` WHERE article_id='" . 
   $_POST['id'] . "'");
   $query->execute();
   $row=$query->fetch(PDO::FETCH_ASSOC);
    var_dump($row);
     if(isset($_POST['editarticle'])){
      if(isset($_POST['title'], $_POST['content'])){
        $title= $_POST['title'];
        $content= nl2br($_POST['content']);
          $query= $pdo->prepare("UPDATE `articles` SET article_title=" 
     .$_POST['title'] .",article_content=" .$_POST['content'] ." WHERE 
      article_id='" . $_POST['id'] . "'");
          $query->execute();
          $row=$query->fetch(PDO::FETCH_ASSOC);
          header('Location: ../index.php');
       }
   }
  ?>
  <html>
   <head>
    <title>CMS Tutorial</title>
    <link rel="stylesheet" href="assets/style.css" />
  </head>
  <body>
  <div class="container">
    <br/>
    <h4>Upravit prispevok</h4>
    <?php if(isset($error)){
    echo $error;
    }?>
    <? $query = $pdo->prepare("SELECT * FROM `articles` WHERE article_id='" 
    . $_POST['id'] . "'");
    $query->execute();
    $row=$query->fetch(PDO::FETCH_ASSOC);
    ?>
    <form action="editarticle.php" method="post" autocomplete="off" 
     class="addarticle">
      <input type="text" name="title" value="<?php echo 
      ucwords($row['article_title']);?>"/><br/><br/>
      <textarea rows="15" cols="50"  name="content"><?php echo 
       ucwords($row['article_content']);?></textarea><br/><br/>
      <input type="submit" name="editarticle" value="Upraviť prispevok"/>
     </form>
    </div>
   </body>
   </html>
  <?php
} } else{
 header('Location: index.php');
}
?>
 
    