I want to make 7 drop down list, the last 5 have the same content, now my problem is that the 3’rd one is displaying all the content, but the rest(4,5,6,7) are displaying only “select movie”.
Here is the code:
@$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']==@$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']==@$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>";
?>
Any advice, any other method is welcome.Thank you.
once you fetch record from mysql result its move its position to next row… by the end of 1st loop the position will remain in end of record state so from the second time loop it will just print blank.
So better:
1.) Store the options list in string
2.) print the list in loop
instead use: