如何传输下拉列表值来自数据库的下拉列表值?
这是我的代码..
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("thesis", $con);
@$setup=$_GET['pqsetup'];
?>
<form id="form1" name="form1" method="post" action="">
<table width="414" border="1" align="center">
<tr>
<td width="84" class="style1">
Set-Up: </td>
<td width="9">
<td width="49">
<?php
$pqsetupquer = mysql_query("SELECT * FROM pqsetup");
echo "<select name='pqsetup' onchange=\"reload(this.form)\">";
echo "<option selected>---------------------</option>";
while($noticia2 = mysql_fetch_array($pqsetupquer)) {
if($noticia2['pqs_no']==@$setup){
echo "<option value='$noticia2[pqs_no]' selected>$noticia2[pqs_name]</option>"."<BR>";
}else
echo "<option value='$noticia2[pqs_no]'>$noticia2[pqs_name]</option>"."<BR>";
}
echo "</select>";
?> </td>
<td width="142">Menu Packages</td>
<td width="32"> <?php
$menuquer=mysql_query("SELECT pqs_no, menu_name FROM menu_packages");
//echo "<select name='menu_name' onchange=\"reload(this.form)\">";
echo "<select name='menu_name'>";
echo "<option selected>---------------------</option>";
while($noticia = mysql_fetch_array($menuquer))
{
if($noticia['pqs_no']==@$setup)
{
echo "<option value='$noticia[pqs_no]' selected>$noticia[menu_name]</option>"."<BR>";
}
else
//echo "<option value='$noticia2[pqs_no]'>$noticia[menu_name]</option>"."<BR>";
echo " ";
}
echo"</select>";
?></td>
</tr>
</table>
</form>
如何传输值并将其显示在另一页?
答案 0 :(得分:0)
当您定义表单操作(可能是另一个显示表单输入结果的页面)时,它会将所选值视为变量。因此menu_name将等于所选值。您需要以可以读取该参数的方式构造表单操作。 您是否已开始为表单构建操作?这是一个非常开放的问题。