我有一个从数据库中填充的选择框,并且想做一个快速搜索或自动完成来搜索选择框中的元素。下面是我的代码:
<?
print("<table>");
print("<tr>");
print("<td>");
//print("<div id='searchable-form' >"); //
print("<div id='searchable'>Search: <input type='text' id='searchFILE' size='33' autocomplete='off' /></div>");
print("<select name='lktyp' id='lktypSearch' size='10' >");
//Create new SQL object
$db = new NSC_SQL($db2config);
$db->from($bllcust1,"BCUST#,BNAME");
$db->order("BCUST#");
$db->select();
$results = $db->fetchAssoc();
$db->dspSQL();
foreach($results as $row)
{
$bcust = trim($row['BCUST#']);
$bname = trim($row['BNAME']);
print("<option value='$bcust'>$bcust ~ $bname</option>");
}
print("</select>");
print("</div>");
print("</td>");
print("</tr>");
print("<tr>");
print("<td colspan='2' align='center'>");
//print("<input type='submit' name='search' value='Search'>");
print("<input type='button' value='Select' onclick='lkp();'>");
print("<input type='button' name='cancel' value='Cancel' onClick='parent.$.fancybox.close();'>");
print("</td>");
print("</tr>");
print("</table>");
?>