hi..this is my file name run.php
[CODE]
<html>
<head>
<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”,”getuser.php?q=”+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<?php
$host=”127.0.0.1″; // Host name
$username=”root”; // Mysql username
$password=””; // Mysql password
$db_name=”ofcccv3″; // Database name
// Connect to server and select databse.
mysql_connect(“$host”, “$username”, “$password”)or die(“cannot connect”);
mysql_select_db(“$db_name”)or die(“cannot select DB”);
$query = “SELECT * FROM car”;
$result = mysql_query($query) or die(mysql_error());
?>
<form>
<select name=”users” onchange=”showUser(this.value)”>
<?php
// Print out the contents of each row into a table
while($row = mysql_fetch_array($result))
{
echo “<option value=”.$row[‘id’].”>” . $row[‘plat’] . “</option>”;
}
$result = mysql_query($query) or die(mysql_error());
?>
</select>
</form>
<br />
<div id=”txtHint”><b>Person info will be listed here.</b></div>
<p></p>
<input name=”engineCC” type=”text” >
</body>
</html>
and also getuser.php file:
[CODE]
<?php
$q=$_GET[“q”];
$con = mysql_connect(‘127.0.0.1’, ‘root’, ”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_select_db(“ofcccv3″, $con);
$sql=”SELECT * FROM car WHERE id = ‘”.$q.”‘”;
$result = mysql_query($sql);
echo “<table border=’1’>
<tr>
<th>CAR PLAT NUMBER</th>
<th>CAR MODEL</th>
<th>CAR CC</th>
<th>CAR TRANSMISSION</th>
</tr>”;
while($row = mysql_fetch_array($result))
{
echo “<tr>”;
echo “<td>” . $row[‘plat’] . “</td>”;
echo “<td>” . $row[‘type’] . “</td>”;
echo “<td>” . $row[‘cc’] . “</td>”;
echo “<td>” . $row[‘trans’] . “</td>”;
echo “</tr>”;
}
echo “</table>”;
mysql_close($con);
?>
::after i run the run.php file.it is success for me to retrieve the data from database using a drop down list..next, what i need to do to make sure that the echo “<td>” . $row[‘cc’] . “</td>”; value also appear in the ‘engineCC text box’
Thanks you for your time