title: onChange refresh particular dropdown list in PHP
body: <p><strong>THE ISSUE?</strong></p>
  
  <p>I need help regarding PHP's onChange command. Basically i'm making a hotel room reservation system. What im trying to do is that there are tow combo boxes.</p>
  
  <ul>
  <li>One for HOTEL NAME (COMBO BOX NO.1)</li>
  <li>the other for FLOOR NO (COMBO BOX NO.2)</li>
  </ul>
  
  <p>What I want to do is that if I select the hotel name form the combo box 1, then the number of floors for that particular hotel, should get auto-populated in combo box 2. (This number of floors information should come from the respective table/field in the database)</p>
  
  <p><strong>WHAT i'VE TRIED TO DO -- THE CODE</strong></p>
  
  <pre><code>&lt;td&gt;Hotel:      
          &lt;select name="hotel_name" id="hotel_name" title="&lt;?php echo $row_rs_hotel['hotel_name']; ?&gt;" onchange="&lt;?php
  while ($row_rs_floor = mysql_fetch_assoc($rs_floor));
    $rows = mysql_num_rows($rs_floor);
    if($rows &gt; 0) {
        mysql_data_seek($rs_floor, 0);
        $row_rs_floor = mysql_fetch_assoc($rs_floor);
    }
  ?&gt;"&gt;
            &lt;?php
  do {  
  ?&gt;
            &lt;option value="&lt;?php echo $row_rs_hotel['hotel_name']?&gt;"&gt;&lt;?php echo $row_rs_hotel['hotel_name']?&gt;&lt;/option&gt;
            &lt;?php
  } while ($row_rs_hotel = mysql_fetch_assoc($rs_hotel));
    $rows = mysql_num_rows($rs_hotel);
    if($rows &gt; 0) {
        mysql_data_seek($rs_hotel, 0);
        $row_rs_hotel = mysql_fetch_assoc($rs_hotel);
    }
  ?&gt;
                                          &lt;/select&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Floor No:      
          &lt;select name="floor_no" id="floor_no" title="&lt;?php echo $row_rs_floor['floor_no']; ?&gt;" onchange="var id=$('hotels_name').val();
  $('floors_no').load('ajax.php?id='+id);
  
  "&gt;
            &lt;?php
  do {  
  ?&gt;
            &lt;option value="&lt;?php echo $row_rs_floor['floor_no']?&gt;"&gt;&lt;?php echo enter code here$row_rs_floor['floor_no']?&gt;&lt;/option&gt;
           &lt;?php
  } while ($row_rs_floor = mysql_fetch_assoc($rs_floor));
    $rows = mysql_num_rows($rs_floor);
    if($rows &gt; 0) {
        mysql_data_seek($rs_floor, 0);
        $row_rs_floor = mysql_fetch_assoc($rs_floor);
    }
  ?&gt;
                  &lt;/select&gt;&lt;/td&gt;
  </code></pre>
  
  <p><strong>WHAT I'M GETTING FROM THE ABOVE CODE??</strong></p>
  
  <p>The combo box number 2 is auto-loaded with the first record in the table when the page is opened. No matter how many times i select the hotel in COMBO BOX 1, the values in combo box 2 remain unchanged.</p>
  
  <p>PLEASE HELP..!!!</p>