title: why doesn't it want to add a post or category?
body: <p>As a school assignment I need to make a cms, in that I need to be able to make post edit them and delete them. so for i can edit and delete them, but for some reason I cant get it to insert the post(and also the categories, same almost the same) I hope you guys can help me. </p>
  
  <p>Here is the code: </p>
  
  <p>The form</p>
  
  <pre><code>   &lt;form action="includes/doAddpost.php" method="post"&gt;
        &lt;label for="PostName"&gt;Name&lt;/label&gt;
        &lt;input type="text" name="PostName" id="PostName" placeholder="Title" autofocus="auto"/&gt;
        &lt;label for="PostAuthor"&gt;Author&lt;/label&gt;
        &lt;input type="text" name="PostAuthor" id="PostAuthor" placeholder="Authors name"
        value="&lt;?php if (isset($_SESSION['username'])) {
        echo $_SESSION['username'];
        }
        ?&gt;"/&gt;
        &lt;label for="PostContent"&gt;Content&lt;/label&gt;
        &lt;textarea name="PostContent" id="PostContent" placeholder="content"&gt;&lt;/textarea&gt;
        &lt;label for="PostCats"&gt;category&lt;/label&gt;
        &lt;select name="PostCats"&gt;
        &lt;?php
        $query = "SELECT * FROM categories";
        $result = mysqli_query($mysqli, $query);
        while ($cat = mysqli_fetch_assoc($result)) {
        ?&gt;
        &lt;option value="&lt;?php echo $cat['id']; ?&gt;"&gt;&lt;&lt;?php echo $cat['title']; ?&gt;&lt;/option&gt;
        &lt;?php } ?&gt;
  </code></pre>
  
  <p>and this part doesnt seem to work either</p>
  
  <pre><code> &lt;/select&gt;
        &lt;input type="submit" name="submit" value="submit"/&gt;
     &lt;/form&gt;
  </code></pre>
  
  <p>Here is the doAddpost page:</p>
  
  <pre><code>&lt;?php
  include '../../includes/functions.php';
  sec_session_start();
  if(isset($_POST['submit'])){
      if(isset($_POST['PostName'])){
          if(isset($_POST['PostContent'])){
          addPost($mysqli,$_POST['PostName'],$_POST['PostAuthor'], $_POST['PostContent'],$_POST['PostCats']);
          header("Location: ../posts.php");
          }else{
              echo"please enter some content!";
          }
      } else{
          echo"please set a category name!";
          include('../addpost.php');
      }
  }else{
      header("Location: ../addpost.php");
  }
  ?&gt;
  </code></pre>
  
  <p>and the function:</p>
  
  <pre><code>function addPost($mysqli, $pName, $pAuthor, $pContent, $pCat = 1)
  {
      $query = "INSERT INTO posts VALUES ('$pName', '$pAuthor', '$pContent', $pCat)";
      mysqli_query($mysqli, $query);
  }
  </code></pre>
  
  <p>Can anyone tell me what is the issue I am facing ?</p>