title: PHP code giving 500 internal server error
body: <p>I am making a trading website and am trying to make users to upload ads. The code that i have written is running fine with no errors when i run it on localhost. But when i hosted the site and then tried to upload the ad i got "500 internal server error". I have made no changes to the code.</p>
  
  <p>submitad file</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Submit Ad&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/signup.css"/&gt;
  &lt;/head&gt;
  
  &lt;?php
  require('heading.php');
  ?&gt;
  
  &lt;form class="submit-ad" action="submitad_validation.php" method="POST" enctype="multipart/form-data"&gt;
      &lt;h1 class="sign-up-title"&gt;Submit Ad&lt;/h1&gt;
      &lt;input type="text" name="title" class="sign-up-input" placeholder="Title" required  autofocus&gt;
      &lt;input type="text" name="description" class="sign-up-input" placeholder="Description" required&gt;
      &lt;input type="text" name="contact" class="sign-up-input" placeholder="Email ID" required&gt;
      &lt;input type="text" name="price" class="sign-up-input" placeholder="Expected Price" required&gt;
  
      &lt;select class="sign-up-input" name="categories" required&gt;
        &lt;option value="mobile"&gt;Mobiles and Accessories&lt;/option&gt;
        &lt;option value="laptop"&gt;Laptops and Accessories&lt;/option&gt;
        &lt;option value="cars"&gt;Cars&lt;/option&gt;
        &lt;option value="bikes"&gt;Bikes&lt;/option&gt;
        &lt;option value="appliances"&gt;Home Appliances&lt;/option&gt;
        &lt;option value="books"&gt;Books&lt;/option&gt;
        &lt;option value="jewelery"&gt;Jewelery&lt;/option&gt;
        &lt;option value="music"&gt;Musical Instruments&lt;/option&gt;
        &lt;option value="pets"&gt;Pets&lt;/option&gt;
      &lt;/select&gt; 
  
      &lt;!-- Code to upload the image of the item --&gt;
      &lt;input type="file" name="imageUpload" id="imageUpload"&gt; 
      &lt;input type="submit" value="Submit Ad" name="submit" class="sign-up-button"&gt;
  
  &lt;/form&gt;  
  &lt;/html&gt;
  </code></pre>
  
  <p>submitadvalidation file</p>
  
  <pre><code>&lt;!--This page is used to get the ad data from the user and then store it in the database--&gt;
  
  &lt;?php
  require('connection.php');
  session_start();
  $title=$_POST['title'];
  $description=$_POST['description'];
  $value=$_POST['categories'];
  $price=$_POST['price'];
  $contact=$_POST['contact'];
  $id=$_SESSION['user_id'];
  
  if(isset($_POST['submit']))
  {
  
      //Process the image that is uploaded by the user
  
      $target_dir = "uploads/";
      $target_file = $target_dir . basename($_FILES["imageUpload"]["name"]);
      $uploadOk = 1;
      $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  
          if (move_uploaded_file($_FILES["imageUpload"]["tmp_name"], $target_file)) {
              echo "The file ". basename( $_FILES["imageUpload"]["name"]). " has been uploaded.";
          } else {
              echo "Sorry, there was an error uploading your file.";}
  
      $image=basename( $_FILES["imageUpload"]["name"],".jpg"); // used to store the filename in a variable
  
      //storing the data in your database
      $query= "INSERT INTO items VALUES ('$id','$title','$description','$price','$value','$contact','$image')";
      mysql_query($query);
  
      require('heading.php');
      echo "Your add has been submited, you will be redirected to your account page in 3 seconds....";
      //redirecting the user back to the account page after successful uploading of the ad
      header( "Refresh:3; url=account.php", true, 303);
  }
  
  ?&gt;
  </code></pre>