title: Change mysql textbox value using dropdown PHP,mysql
body: <p>I have texbox and dropdown list which is populated from mysql.I want to change textbox value using dropdown list.My textbox value also populated from mysql.Here is my code.Thanks in advance.</p>
  
  <pre><code>&lt;?php
  if(!isset($_SESSION)){
      session_start();
  }
  
  $dingo=$_SESSION['dingo'];
  $query11="Select ISO3,Notify,Dingoid from rahul_tbl_users where Dingoid=$dingo";
  $query123=mysql_query($query11);
  $query1234=mysql_fetch_array($query123);
  $fetch=mysql_query(" SELECT tdd.Dingoid,
                              tc.Dingoid,
                              tc.A_End,
                              tbidd.OpportunityNumber,
                              tbidd.Status,
                              tbidd.Country,
                              tbidd.OpportunityName,
                              tbidd.Allocatedto,
                              tbidd.Email,
                              tbidd.Customer,
                              tbidd.Country,
                              tbidd.ContactName,
                              tc.Usertype,
                              tbidd.G1_OPPID
                          FROM  scott123.rahul_tbl_users tdd 
                              INNER JOIN scott123.rahul_user_opps tc 
                                  ON tdd.Dingoid=tc.Dingoid 
                              INNER JOIN scott123.rahul_tbl_opportunities tbidd
                                  ON tc.A_End=tbidd.OpportunityNumber
                          WHERE tc.Dingoid =$dingo"
                           );
  $fetch_result=mysql_fetch_array($fetch);
  ?&gt;
  
  &lt;?php
  $SQLString="SELECT distinct(G1_OPPID),ContactName from rahul_tbl_opportunities
                  WHERE G1_OPPID IS NOT NULL and ContactName!='' ";
  $result1 = mysql_query($SQLString);
  ?&gt;
  
  &lt;form id="form1" method="post" action=""&gt; &lt;br&gt;
   &lt;table class="gridtable"&gt;
     &lt;tr&gt;
          &lt;th&gt;
              &lt;strong&gt;Users Permission &lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
              &lt;br&gt;
              &lt;tr&gt;
              &lt;td&gt;
                  &lt;?php
                      //filename: populate.php
                      if (!empty($_POST)) {
                          switch ($_POST['select1']) {
                              case 1: 
                                  $value = $rows1['ContactName'];
                                  break;
                              default:
                                  $value = '';
                          }
                      }
                  ?&gt;
                  &lt;select name="select1"  onchange="onchange="this.form.submit();"&gt;
                  &lt;?php
                      while($rows1=mysql_fetch_array($result1)){
                  ?&gt;
                      &lt;option id='user_name' value="&lt;? echo $rows1['ContactName']; ?&gt;"&gt;&lt;? echo $rows1['ContactName']; ?&gt;&lt;/option&gt;
                  &lt;?php
                      }
                  ?&gt;
                      &lt;input type="text" name="test" value="&lt;?php echo $value;?&gt;" /&gt;
                  &lt;/select&gt;
  
                  &lt;input type="submit" name="submit_name11" value="Add Permission"/&gt;
                  &lt;input type="submit" name="submit_name12" value="Edit Permission"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
     &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>