title: PHP, using $_FILES and $_POST at the same time but its not working
body: <p>I am making a admin page to insert all attribute in MySQL and image upload in one folder but getting some error ,Here is code of form</p>
  
  <pre><code>&lt;form role="form" id="form1" action="" enctype="application/x-www-form-urlencoded"  method="post"&gt;
      &lt;div class="col-lg-6"&gt;
          &lt;div class="form-group"&gt;
              &lt;label&gt;Title:&lt;/label&gt;
              &lt;input type="text" name="title" placeholder="enter title" class="form-control"required&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;div class="col-lg-6 col-md-6 col-sm-6"&gt;  
                  &lt;label&gt;Image:&lt;/label&gt;
                  &lt;input type="file" name="upload" id="postimage" class="form-control"&gt; 
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;input type="reset" name="reset" value="reset"&gt;
      &lt;/div&gt;
      &lt;div class="col-lg-6"&gt;
          &lt;div class="form-group"&gt;
              &lt;label&gt;Content:&lt;/label&gt;
              &lt;input type="text" class="form-control" name="content" placeholder="explain in brief"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label&gt;Age:&lt;/label&gt;
              &lt;input type="text" class="form-control" placeholder="enter require age" name="age"&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;input type="submit" name="submitpost" value="Submit-Post" class="form-control"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and when i am using PHP code for inserting my image in one folder name img and other attributes in MySQL table.</p>
  
  <pre><code>&lt;?php
      $target_dir = "../../img/";
      if (isset($_FILES['upload'])and isset($_POST['submitpost'])) {   
          $target_file = $target_dir . basename($_FILES["upload"]["name"]);
              if(move_uploaded_file($_FILES["upload"]["tmp_name"], $target_file)){
                  $title=$_POST['title'];
                  $age=$_POST['age'];
                  $content=$_POST['content'];
                  $query="INSERT INTO `posts`
                              (`id`,`title`, `image`,`age`, `content`) 
                      VALUES (null,'$title','$target_file','$age','$content')"; 
                  if(mysqli_query($con,$query))
                  {
                      echo "&lt;script&gt;alert('passed')&lt;/script&gt;";
                  }else{
                      echo "&lt;script&gt;alert('not passed')&lt;/script&gt;";
                  }
              }else{
                  echo "&lt;script&gt;alert('problem with image upload')&lt;/script&gt;";}
          }
      ?&gt;
  </code></pre>
  
  <p>But after submitting i am getting nothing, neither error or any notice nothing ,i don't know what is problem help me and I did try some other code then its inserting in table but image does not uploading in target folder .Help me through it i am new in PHP , so </p>