怎么把php菜单循环显示数据库的信息提取出来?急!急!急!
$rs=mysql_query("selectdistinctstaff_nationalfromstaff_info");<selectname="select_...
$rs = mysql_query("select distinct staff_national from staff_info");
<select name="select_national" id="select_national">
<option value="0" selected="selected">民族</option>
<?php while($record=mysql_fetch_array($rs)){?>
<option value="<?php echo $record["staff_national"] ?>"><?php echo $record["staff_national"]; ?></option>
<?php } ?>
</select>
用意是:在菜单中显示数据库中已有不重复的信息,然后选择菜单下拉项后,把选择的项用echo输出 展开
<select name="select_national" id="select_national">
<option value="0" selected="selected">民族</option>
<?php while($record=mysql_fetch_array($rs)){?>
<option value="<?php echo $record["staff_national"] ?>"><?php echo $record["staff_national"]; ?></option>
<?php } ?>
</select>
用意是:在菜单中显示数据库中已有不重复的信息,然后选择菜单下拉项后,把选择的项用echo输出 展开
1个回答
展开全部
加上表单
<FORM METHOD=POST ACTION="test.php">
$rs = mysql_query("select distinct staff_national from staff_info");
<select name="select_national" id="select_national">
<option value="0" selected="selected">民族</option>
<?php while($record=mysql_fetch_array($rs)){?>
<option value="<?php echo $record["staff_national"] ?>"><?php echo $record["staff_national"]; ?></option>
<?php } ?>
</select>
<INPUT TYPE="submit" name="submit" value="submit">
</FORM>
test.php文件:
$select_national = $_POST['select_national'];
echo $select_national;
<FORM METHOD=POST ACTION="test.php">
$rs = mysql_query("select distinct staff_national from staff_info");
<select name="select_national" id="select_national">
<option value="0" selected="selected">民族</option>
<?php while($record=mysql_fetch_array($rs)){?>
<option value="<?php echo $record["staff_national"] ?>"><?php echo $record["staff_national"]; ?></option>
<?php } ?>
</select>
<INPUT TYPE="submit" name="submit" value="submit">
</FORM>
test.php文件:
$select_national = $_POST['select_national'];
echo $select_national;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询