<html>
<head>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
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","testdropdown.php?q="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<tr>
<td>Company<span>*</span></td><td>
<?
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
mysql_query("SET NAMES UTF8");
$objDB = mysql_select_db("thaimee");
$query = mysql_query("select DISTINCT company_name_english from supplier ORDER BY company_name_english ASC;"); // Run your query
echo '<select name="Company">'; // Open your drop down box
// Loop through the query results, outputing the options one by one
while ($row = mysql_fetch_array($query)) {
echo '<option value="'.$row['company_name_english'].'">'.$row['company_name_english'].'</option>';
}
echo 'Thaimeetable</select>';// Close your drop down box
?>
</td>
</tr>
<br>
<div id="txtHint"></div>
</body>
</html>