我想做出7個下拉列表,最後5個有相同的內容,現在我的問題是,第三個顯示所有的內容,但其餘(4,5,6,7)只顯示「選擇電影」。 下面是代碼:如何在表單中添加相同的下拉列表5次?
@$pro=$_GET['pro'];
if(strlen($pro) > 0 and !is_numeric($pro)){/
echo "Data Error";
exit;
}
$quer=mysql_query('SELECT DISTINCT programName,programId FROM '.TBL_PROGRAM.' order by programId');
if(isset($pro) and strlen($pro) > 0){
$quer2=mysql_query("SELECT DISTINCT categorieName,id FROM ".TBL_CATEGORIE."where id=$pro order by id");
}else{
$quer2=mysql_query("SELECT DISTINCT categorieName,id FROM ".TBL_CATEGORIE." order by id");
}
if(isset($pro) and strlen($pro) > 0){
$quer3=mysql_query("SELECT DISTINCT movieName,movieId FROM ".TBL_MOVIE." where movieId=$pro order by movieId");
}else{
$quer3=mysql_query("SELECT DISTINCT movieName,movieId FROM ".TBL_MOVIE." order by movieId");
}
echo "<form method=POST name=f1 action='program.php'>";
echo "<select name='pro[]' style='width:150' onchange=\"reload(this.form)\"><option value=''>Make your Program</option>";
while($noticia = mysql_fetch_array($quer)) {
if($noticia['programId'][email protected]$pro)
{
echo "<option selected value='$noticia[programId]'>$noticia[programName]</option>"."<BR>";}
else{
echo "<option value='$noticia[programId]'>$noticia[programName]</option>";}
}
echo "</select>";
echo "<BR>";
echo "<select name='pro[]' style='width:150' onchange=\"reload3(this.form)\"><option value=''>Choose Categorie</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['id'][email protected]$pro)
{
echo "<option selected value='$noticia2[id]'>$noticia2[categorieName]</option>"."<BR>";}
else{
echo "<option value='$noticia2[id]'>$noticia2[categorieName]</option>";}
}
echo "</select>";
echo "<BR>";
$i=0;
while($i<5){
echo "<select name='pro[]' style='width:150' ><option value=''>Select movie</option>";
while($noticia3 = mysql_fetch_array($quer3)) {
echo "<option value='$noticia3[movieId]'>$noticia3[movieName]</option> ";
}
echo "</select>";
echo "<BR>";
$i++;
}
echo"<input type=hidden name=submit value=1>";
echo "<input type=submit value=Submit>";
echo "</form>";
?>
任何意見,任何其他方法welcome.Thank你。
謝謝you.It workes。 – user747192 2011-05-30 17:26:36