rpv_sen 59 Junior Poster

HI
Please help. how to solve this

I am using the below code. insert is working fine. but i am having problem in edit session
i edit page i can able to display both values from Database. If i am changing the textbox1 value i am not able to get the releated value in textbox2.

Test.php

<tr>
      <td>Connection Type</td>
      <td><input type='' name='conn_type' id='conn_type' onkeyup='AddToStack();' onChange='showptype(this.value)'></td>
    </tr>
    <tr>
      <td>Type</td>
      <td><div id='txtHint' name='ptype'></div></td>
    </tr>

    <script type="text/javascript">

function showptype(str1)
{
if (str1=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getptype.php?q="+str1,true);
xmlhttp.send();
}
</script>

getptype.php

<?php
session_start();
include('conn.php');

 $q=$_GET['q'];

 //$qi = count($q);

//$bcom = odbc_result($bcompany,"MCCO");
$query="select * from $database.FQ64006 WHERE SCYQ64CTYPE='$q'";
$result = odbc_exec($connection,$query);
?>
<input type="text" name="ptype" id="ptype" value="<?php $SCYQ64TYPE1 = odbc_result($result,"SCYQ64TYPE"); echo $SCYQ64TYPE = trim($SCYQ64TYPE1) ?>" readonly >

?>

Edit.php

<tr>
    <td>Connection Type</td>
    <td><input type='text' name='conn_type' id='conn_type' value='<?php $SDYQ64CTYPE1 = odbc_result($rowsid,"SDYQ64CTYPE"); echo $SDYQ64CTYPE = trim($SDYQ64CTYPE1); ?>' onkeyup='AddToStack();' onChange='showptype(this.value)'></td>
</tr>
<tr>
    <td>Type</td>
    <td><?php if($SDYQ64CTYPE=='') { ?><div id='txtHint' name='ptype'></div><?php } else {?><input type='text' name='p_type' id='p_type' value='<?php $SDYQ64TYPE1 = odbc_result($rowsid,"SDYQ64TYPE"); echo $SDYQ64TYPE = trim($SDYQ64TYPE1); ?>'><?php } ?></td>
                                  </tr>