要使用AJAX了, 菜单联动就可以了;
参考如下:
<?php//require_once('conn.php') //写个连接数据库的文件 每次包含一下就行了, 而且要写在最上面。
$con = mysql_connect("localhost","root","***")
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<select>
<option>-请选择-</option>
<?php
$sql="select CID from course2"
$result=mysql_query($sql)
while($row=mysql_fetch_assoc($result)){
?>
<option value="$row['CID']"><?php echo $row['CID'] ?></option> //这个值要用php的方法取出来
<?php
}
?>
</select>
</body>
</html>
<?php$con = mysql_connect("localhost","root","")//连接数据库
mysql_select_db('test')//选择数据库
?>
<html>
<head>
<title>dropdown from mysql</title>
</head>
<body>
<h1>dropdown from mysql</h1>
<form action="#" method="post">
<select>
<option value=0>--请选择--</option>
<?php
$sql= "select val from custom where field='hook_load'"//sql语句
$result = mysql_query($sql, $con)//执行sql语句
while($row = mysql_fetch_array($result))
{
echo "<option value='$row[val]'>$row[val]</option>"//循环,拼凑下拉框选项
}
?>
</select>
</form>
</body>
</html>
首先你要select*
from
album
where
uid=YourID
然后用while循环输出,应该是echo吧
sql="select
*
from
album
where
uid=YourID"
输出<select>
while循环
在循环内部输出<option>title</option>
输出</select>
大概其是这样,你调试下
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)