title: Notice: Undefined variable: title in E:\xampp\htdocs\blog4\new-post.php on line 11
body: <p>Notice: Undefined variable: title in E:\xampp\htdocs\blog4\new-post.php on line 11</p>
  
  <p>I keep getting this error and also Missing data is appearing before any data is submitted</p>
  
  <pre><code>include('db.php');
  
          if(isset($_POST['submit'])){
          $title = $_POST['title'];
          $body = $_POST['body'];
  
  }
  
  if($title &amp;&amp; $body){
              $query = mysql_query("INSERT INTO posts (title, body) VALUES('$title', '$body')");
              if($query){
                  echo"Post Added";
                  }else{
                  echo"error";}
          }else{
              echo"Missing data";
          }
  </code></pre>