using javascript and php server to set textbox value after a dropdown value is selected
<p>I am using a form which will retrieve values to set the textbox inputs after a dropdown value is selected. My problem comes from the fact that my php server fnction is designed to take the selected index of dropdown as parameter and return related values to populate the textboxes. I however can't figure out how to combine the php function and the javascript which will do the textbox value setting. Below is my sample code. Any help appreciated.</p>

<p>As can be seen below, displayGamsProjectInfo(fe) function calls the database function ddGamsProjectInfo($gamsId) but how can I can I allow the php function to 'pick' the selected dropdown index without the user POSTing the form values (after maybe button clicked)</p>

<p>javascript/php:</p>

<pre><code>    &lt;script language='javascript'&gt;function displayGamsProjectInfo(fe){
   document.all.FACILITY_RC_ID.value= '';
   document.all.FACILITY_FACULTY_ID.value= '';
   document.all.FACILITY_SUPVSOR_NAME.value= '';
   document.all.FACILITY_SUPVSOR_TELNUM.value= '';
   document.all.FACILITY_SUPVSOR_EMAIL.value= '';
   if(fe.value != null &amp;&amp; fe.value != ''){\n";
   $getGamsInfo = FacilityDB::getInstance()-&gt;***ddGamsProjectInfo()***;
   if($getGamsInfo &amp;&amp; $getGamsInfo != null){ 
      if($row = oci_fetch_array($getGamsInfo)){ 
        print "document.all.FACILITY_RC_ID.value= '$row[RES_CENTER]';
        document.all.FACILITY_FACULTY_ID.value= '$row[FACULTY_ID]';
        document.all.FACILITY_SUPVSOR_NAME.value= '$row[STAFF_NAME]';
        document.all.FACILITY_SUPVSOR_TELNUM.value= '$row[STAFF_TELNUM]';
        document.all.FACILITY_SUPVSOR_EMAIL.value= '$row[STAFF_EMAIL]';\n";                      
        }
      }                                             
   print "}\n
}&lt;/script&gt;"
</code></pre>

<p>php function:</p>

<pre><code>public function ddGamsProjectInfo($gamsId){
if(!isset($gamsId) || $gamsId == '' || $gamsId == null)
   return null;
else{
   $sql = "....";       
   $stmt = oci_parse($this-&gt;con, $sql);
   oci_execute($stmt);
   return $stmt;
}
</code></pre>

<p>}</p>
