I am having two tables. Order and grademaster.. In grademaster table i have two fields 'packing' and 'condition'.. I am using php mysql and ajax. If a person select grade value of packing and condition should be autopopulate in the textboxes.. I have successfully loaded value of one textbox through php ajax but the second text box cannot accept values. I have tried calling two functions from onchange() but no result.. Please suggest me how can i populate two text boxes from one ajax selection. my code below
//javascript
<script type="text/javascript">
function showUser(str)
{
if (str=="")
{
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","getgradepacking.php?q="+str,true);
xmlhttp.send();
}
</script>
<div>
<label>Packing <strong>*</strong></label>
<textarea id="txtHint" name="txtpacking" id="txtpacking" cols="42" rows="4"></textarea>
</div>
//getgradepacking.php
<?php
$q=$_GET["q"];
include('includes/connect.php');
mysql_select_db($Db, $link);
$sql="SELECT * FROM grademaster WHERE gradeid = '".$q."'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$packing = $row['packing'];
echo $packing;
?>