<?php
include("conn.php");
$sql = mysql_query("select name from liuyanban group by name");
$arr = array();
while($row = mysql_fetch_row($sql)){
$arr[]= $row[0];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script type="text/javascript">
var counts;
counts=0;
var arr=eval(<?php echo json_encode($arr);?>);
document.write(arr);
counts=arr.length;
function Myselect(){
var i;
for (i=0;i < counts; i++) {
document.form1.sel.options[i] = new Option(arr[i],arr[i]);
}
}
</script>
</head>
<body>
<table width="280" height="160" border="0" align="center" cellpadding="5" cellspacing="0">
<form name="form1">
<table width="235" height="69" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="21"><select name="sel" id="sel" onFocus="Myselect()">
</select></td>
</tr>
<tr>
<td height="120"> </td>
</tr>
</table>
</form>
</table>
</body>
</html>
mysql数据加载到选择项
最新推荐文章于 2024-05-17 17:47:53 发布