开发者

how to transfer the value of a dropdown where the dropdown's value came from the database?

how to transfer the value of a dropdown where the dropdown's value came from the database?

here is my code..

<?php


$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_d开发者_运维技巧b("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>

how can i transfer the value and just display it in another page??


When you define the form action (probably another page to show the results of your form inputs) it will be expecting the selected values as variables. So menu_name will equal the selected value. You need to construct your form action in such a way that it can read that parameter. Have you started constructing an action for the form to take? This is a very wide-open question otherwise.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜