title: How to pass one listbox value to other listbox with one click
body: <p>I am building a online store application by using php and mysql. I made a list box which can be used to list out the main categories.. once we select the main categories, the sub categories should comes down. How can we accomplished this task without button press or page reload.</p>
  
  <p>the code for list box</p>
  
  <pre><code>&lt;select name="category" id="inputarealistproduct" onfocus="getsubcat();"&gt;
          &lt;option&gt; Select category&lt;/option&gt;
      &lt;?php 
          $query="select id, categories_name from categories where parent_id=0";
          $result=mysql_query($query);
          while(list($id, $name)=mysql_fetch_row($result)) 
          {
              echo "&lt;option value=\"".$id."\"&gt;".$name."&lt;/option&gt;";            
          }
      ?&gt;&lt;/select&gt;
  </code></pre>
  
  <p>and the table design is</p>
  
  <p>id  categories_name     parent_id   categories_sort</p>
  
  <p>plz help me</p>
  
  <p>Thanks</p>