jquery - Change textbox value using dropdown selected in php and mysql -


i have texbox , dropdown list populated mysql database.i want change textbox value using dropdown list, without refreshing page. here code , in advance.

<select name="select" id="dropdownlist1">      <option id="0">-- select company --</option>            <?php               require("dbcon.php");          $getallcompanies = mysql_query("select * ifcandetails6");          while($viewallcompanies = mysql_fetch_array($getallcompanies)){              ?>  <option id="<?php echo $viewallcompanies['tcuid']; ?>"><?php echo $viewallcompanies['tcname'] ?></option>                 <?php                       }                   ?>               </select> 

here input field code:

<input type="text" id="field1" value="<?php echo $viewallcompanies['tcname']?>" disabled/> 

use following

   $(document).ready(function(){     $("#dropdownlist1").change(function(){         $("#field1").val($(this).val());     });    });  

as can on front side itself, dont need change in php code. add following code on dom ready.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -