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

rewrite asp to php based on asp query -

android - questions about switching from C2DM to GCM -

visual studio 2010 - Error on RDLC Expression -