title: how to get value of drop down in same php page with mysql database
body: <pre><code>&lt;div&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
  $('#selectstate').change(function() {
  window.location = "dropexmpl.php?stateval=" + $(this).val();
  });
  $('#selectcity').change(function() {
          window.location = "dropexmpl.php?cityval=" + $(this).val();
      });
  });
  &lt;/div&gt;
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body &gt;
  &lt;div&gt;
  &lt;?php
  //state drop down
      echo "&lt;td"." id="."id_sel_state"."&gt;";
      $con=mysql_connect("localhost","root","");
          mysql_select_db("data_filter",$con);
      $query=("SELECT id,state_name FROM state_details ");
      $result = mysql_query ($query); 
      echo "&lt;label id='statelab'&gt;Select state : &lt;/label&gt;"."&lt;select name='filterstate'id='selectstate' onchange='getstateval()'&gt;";
  
      while ($nt = mysql_fetch_array($result)){
      echo "&lt;option value='".$nt['id']."'&gt;".$nt['state_name']."&lt;/option&gt;";
      }
      echo "&lt;/select&gt;";
  //city drop down
      $statestrval= $_GET['stateval'];
      echo "&lt;td id='id_sel_city'&gt;";
      $query1="SELECT id,state_id,city_name FROM city_details WHERE state_id=".$statestrval."";                                                                               $result1 = mysql_query ($query1);
      echo "&lt;label&gt;Select city : &lt;/label&gt;"."&lt;select name='filtercity' id='selectcity' &gt;";
      while ($nt = mysql_fetch_array($result1)){
      echo "&lt;option value='".$nt['id']."'&gt;".$nt['city_name']."&lt;/option&gt;";
      }
      echo "&lt;/select&gt;";
  
  //Zone drop down
  
      $citystrval= $_GET['cityval'];
      echo "&lt;td id="."id_sel_zone"."&gt;";
      $query2="SELECT id,city_id,zone_area FROM zone_details WHERE city_id=".$citystrval."";                          
  
      $result2 = mysql_query ($query2);
      echo "&lt;label&gt;Select industry zone : &lt;/label&gt;"."&lt;select name='filterzone' id='selectzone'&gt;";
      while ($nt = mysql_fetch_array($result2)){
      echo "&lt;option value='".$nt['id']."'&gt;".$nt['zone_area']."&lt;/option&gt;";
      }
      echo "&lt;/select&gt;";
      mysql_close($con);
  ?&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>here i used 3 drop down state city and zone.it works but when page is reloaded with window.location code it show me the page with refresh effect how it solve by using ajax.
  it should be like when i select the state is should be shows city list related to that state.when city is selected it should be shows the zone related to that city .but problem is when i go to select the city it change the state list and when i select zone it change the city list because of reloading of page how i can solve this problem.</p>