本文介绍了用按钮填充下拉框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想在网页上设置一个按钮。单击它时,将下载下拉框。我下面的代码工作正常,但我宁愿从一个空的下拉框开始,并在单击按钮时加载它。这是我的工作代码....I am trying to have a button on a webpage. When you click on it, the Dropdown box will load. The code I have below works fine, but I would rather start with an empty dropdown box and have it load when the button is clicked. Here is my working code....<?php$dbc = mysql_connect('','','') or die('Error connecting to MySQL server.');mysql_select_db('MyDB');$result = mysql_query("select * from tblRestaurants order by RestName ASC");?><!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" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>SEARCH</title></head><body><form method="post" action="1004mcout.php"><p><center>SEARCH</CENTER></P><select name="RestName"><?phpwhile ($nt= mysql_fetch_assoc($result)){ echo '<option value="' . $nt['RestID'] . '">' . $nt['RestName'] . '</option>';}?></select><p> SPACE</p><p></p><p>Click "SUBMIT" to display the calculation results</p><input type="submit" name="Submit" value="Submit" /><br /></form></body></html>推荐答案 这篇关于用按钮填充下拉框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-02 04:44