insert one block of data into database while other block is hidden
<p>I have this code, and what it does is it inserts data to database. I have two  one is called autobox, second housebox. When I select auto from dropdown list the autobox tbody displays with a dropdown list and a text input. Samo with housebox. 
What I trying to accomplish is: When the autobox is displayed and housebox is hidden, and I fill up the form then submit it the housebox won't be inserted into database. 
I hope I clear about this </p>

<p>This code is not safe to use as it is: SQL INJECTION</p>

<pre><code>  &lt;script&gt;
    function addSubject(){
   selectedSubject = document.getElementById('subcategory').value
   if (selectedSubject == 'auto'){
    document.getElementById('autobox').style.display = 'block';

}else if (selectedSubject == 'house'){
    document.getElementById('housebox').style.display = 'block';
   } 
   }
   &lt;/script&gt;

   &lt;?php    
   if(isset($_POST['upload'])){
   $title = $_POST['title'];
   $description = $_POST['description'];
   $price = $_POST['price'];
   $subcategory = $_POST['subcategory'];
   $mileage = $_POST['mileage'];
   $make = $_POST['make'];


   $query = "INSERT INTO classifieds (id, subcategory, title, description, mileage, 

   make, price, broom ) VALUES ('', $subcategory, '$title', '$description', 

   '$mileage', '$make', '$price', '$broom')";
    mysql_query($query) or die(mysql_error());

   } 
   ?&gt;

   &lt;form action="insert.php"  method="post" name="insert" enctype="multipart/form-

  data"&gt;

  &lt;select name="subcategory" id="subcategory" onchange="addSubject()"  &gt;
   &lt;option value=""&gt;Select Manufacturer&lt;/option&gt;
  &lt;option value="auto"&gt;Auto&lt;/option&gt;
  &lt;option value="house"&gt;House&lt;/option&gt;
  &lt;/select&gt;
  &lt;span class="style64"&gt;Title&lt;/span&gt; 
      &lt;input type="text" name="title" class="input"/&gt;

  &lt;table&gt;
  &lt;tbody class="autobox"  id="autobox" style="display: none;" &gt;
  &lt;tr&gt;
   &lt;td class="title"&gt;Enter mileage:&lt;/td&gt;
  &lt;td class="field"&gt;
  &lt;input type="text" name="mileage" size="8" maxlength="7"  /&gt;&lt;/td&gt;
   &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
   &lt;span&gt;Select Manufacturer : &lt;/span&gt;

  &lt;select name="make"&gt;
  &lt;option value="Ford"&gt;Ford&lt;/option&gt;
  &lt;option value="Chevrolet"&gt;Chevrolet&lt;/option&gt;
  &lt;option value="Audi"&gt;Audi&lt;/option&gt;
      &lt;/select&gt;

 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;

 &lt;tbody class="housebox"  id="housebox" style="display: none;" &gt;
 &lt;tr&gt;
 &lt;td class="title"&gt;Enter Price:&lt;/td&gt;
 &lt;td class="field"&gt;
  &lt;input type="text" name="price" size="8" maxlength="7"  /&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;

  &lt;select name="broom"&gt;
&lt;option value="1b"&gt;1 broom&lt;/option&gt;
&lt;option value="2b"&gt;2 broom&lt;/option&gt;
&lt;option value="3b"&gt;3 broom&lt;/option&gt;
      &lt;/select&gt;

   &lt;/td&gt;
   &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;

   &lt;textarea name="description" rows="5" class="input"&gt;&lt;/textarea&gt;
   &lt;input type="submit" name="upload" value="Continue" /&gt;
                    &lt;/form&gt;
</code></pre>

<p>Thanks </p>
