All pastes #460260 Raw Edit

Mine

public text v1 · immutable
#460260 ·published 2007-04-26 23:25 UTC
rendered paste body
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.make.options[form.make.options.selectedIndex].value;
self.location='dd.php?make=' + val ;
}
</script>
</head>

<body>
<?
///////// Getting the data from Mysql table for first list box//////////
$quer2=mysql_query("SELECT DISTINCT make,make_id FROM make order by make"); 
///////////// End of query for first list box////////////

/////// for second drop down list check if make is selected else display all the models///// 
if(isset($make) and strlen($make) > 0)
{
$quer=mysql_query("SELECT DISTINCT model FROM model where make_id='$make' order by model"); 
}
else
{
$quer=mysql_query("SELECT DISTINCT model FROM model order by model"); 
} 
////////// end of query for second models drop down list box ///////////////////////////

echo "<form method=post name=f1 action=dd-check.php>";

//////////        Starting of make drop downlist /////////
echo "<select name='make' onchange=\"reload(this.form)\"><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_array($quer2)) 
{ 
	if($noticia2['make_id']==@$make){echo "<option selected value='$noticia2[make_id]'>			$noticia2[make]</option>"."<BR>";
}
else
{
echo  "<option value='$noticia2[make_id]'>$noticia2[make]</option>";
}
}
echo "</select>";
//////////////////  This will end the make drop down list ///////////

//////////        Starting of model drop downlist /////////
echo "<select name='model'><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($quer)) 
{ 
echo  "<option value='$noticia[model]'>$noticia[model]</option>";
}
echo "</select>";
//////////////////  This will end the model drop down list ///////////
echo "<input type=submit value=Submit>";
echo "</form>";
?>