title: some combobox reset each other after selected
body: <p>I have some combobox with onchange event, and they're reset each other when selected the orther one of them, does any suggest how to retain the value on the page? this my script :</p>
  
  <pre><code>&lt;form method="POST" name="form1" action="&lt;?php $_SERVER['PHP_SELF'];?&gt;"&gt;
      &lt;table border="0"&gt;
          &lt;tr&gt;
              &lt;td colspan="6"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;select name="select_petugas1" style="width:18px;" onchange="this.form.submit('select_petugas1');"&gt; //first combobox
                      &lt;option&gt;&lt;/option&gt;
                      &lt;?php include 'dbconn.php';
                          $sql_peg1="SELECT * FROM users"; $result_peg1=$conn-&gt;query($sql_peg1);
                          while( $row_peg1=$result_peg1-&gt;fetch_assoc() ){ 
                              echo "&lt;option&gt;".$row_peg1['nama']."&lt;/option&gt;";
                          }
                      ?&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
              &lt;td&gt;
  
              &lt;?php 
                  if(isset($_POST['select_petugas1'])){
                      $select_petugas1=$_POST['select_petugas1'];
                      echo "&lt;input type='text' name='select_petugas1' value='".$select_petugas1."'&gt;"; // Throw 1st result into the text box
                      $sql_NIP1="SELECT NIP FROM users WHERE nama='$select_petugas1'";
                      $result_NIP1=$conn-&gt;query($sql_NIP1);
                      $row_NIP1=$result_NIP1-&gt;fetch_assoc();
                      $NIP1=$row_NIP1['NIP'];
              ?&gt;
              &lt;/td&gt;
              &lt;td&gt;&amp;nbsp;NIP&lt;/td&gt;
              &lt;td&gt;:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name='NIP1' value="&lt;?php echo $NIP1; ?&gt;"&gt;&lt;/td&gt;
          &lt;/tr&gt; &lt;!-- child of first result --&gt;
          &lt;tr&gt;
              &lt;td colspan="5" bgcolor="blue"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;select name="peg_2"  style="width:18px;" onchange="submit(this)"&gt;&lt;!--2nd combobox--&gt;
                      &lt;option&gt;&lt;/option&gt;
                  &lt;?php
                      $sql_peg2="SELECT nama FROM users";
                      $result_peg2=$conn-&gt;query( $sql_peg2 );
                      while ($row_peg2=$result_peg2-&gt;fetch_assoc()){
                          echo "&lt;option value='".$row_peg2['nama']."'&gt;".$row_peg2['nama']."&lt;/option&gt;";
                      }
                  ?&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
              &lt;td&gt;
              &lt;?php
                  if( isset($_POST['peg_2']) ){
                      $peg_2=$_POST['peg_2'];
                      echo "&lt;input type='text' name='peg2' value='".$peg_2."'&gt;"; // 2nd result throw into 2nd texbox
                      $sql_NIP2="SELECT NIP FROM users WHERE nama='$peg_2'";
                      $result_NIP2=$conn-&gt;query($sql_NIP2);
                      $row_NIP2=$result_NIP2-&gt;fetch_assoc();
              ?&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&amp;nbsp;NIP&lt;/td&gt;
                      &lt;td&gt;:&lt;/td&gt;
                      &lt;td&gt;&lt;input type='text' name='NIP2' value="&lt;?php echo $row_NIP2['NIP'];?&gt;"&gt; &lt;!--2nd child of result--&gt;
              &lt;?php
                  }
              }
              if(isset($_POST['NIP2'])){
                  $NIP2=$_POST['NIP2'];
                  echo "&lt;br /&gt; NIP2 :".$NIP2."&lt;br /&gt;";
              }
              mysqli_close($conn);
              ?&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  
  &lt;form method="POST" name="wilayah" id="wilayah" action="&lt;?php $_SERVER['PHP_SELF'];?&gt;"&gt;
      &lt;table border="1"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;select name="select_provinsi" onchange="submit(this)" style="width:18;"&gt;
                      &lt;option selected&gt;PROVINSI&lt;/option&gt;
                      &lt;?php 
                          include 'dbconn.php';
                          $sql_prov="SELECT * FROM wilayah GROUP BY provinsi";
                          $result_prov=$conn-&gt;query($sql_prov);
                          echo "";
                          while($row_prov=$result_prov-&gt;fetch_assoc()){
                              $provinsi=$row_prov['provinsi'];
                              echo "&lt;option value='".$provinsi."'&gt;".$provinsi."&lt;/option&gt;";
                          }
                      ?&gt;
                  &lt;/select&gt;
                  &lt;?php   
                      if(isset($_POST['select_provinsi'])){
                          $select_provinsi=$_POST['select_provinsi'];
                          echo "
                                  &lt;input type='text' name='select_provinsi' value='".$select_provinsi."' placeholder='PROVINSI'&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;";
  
  
                          $sql_kabkota="SELECT * FROM wilayah WHERE provinsi='$select_provinsi' GROUP BY kab_kota";
                          $result_kabkota=$conn-&gt;query($sql_kabkota);
                  ?&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;select name="select_kabkota" style="width:18px;" onchange="submit(this)"&gt;&lt;option&gt;KAB/KOTA&lt;/option&gt;
                      &lt;?php
                          while($row_kabkota=$result_kabkota-&gt;fetch_assoc()){
                              echo "&lt;option&gt;".$row_kabkota['kab_kota']."&lt;/option&gt;";
                          }
                      ?&gt;
                      &lt;/select&gt;
                      &lt;?php
                      } 
                      if(isset($_POST['select_kabkota'])){
                          $select_kabkota=$_POST['select_kabkota'];
                      ?&gt;
                          &lt;input type="text" name="kab_kota" value="&lt;?php echo $select_kabkota;?&gt;"&gt;
                      &lt;?php
                          }
                          mysqli_close($conn);
                      ?&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;       
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>hope any suggestion for resolved of my problem with them,, </p>