hi frnds,

  i had four drop-down lists,
1.field of study
2.subject(disabled)
3.country
4.location(disabled)
if i click on field of study  the subject drop-down also in enable
condition.
 i got it this.
what's my problem is if i click on counry drop down list i can't get
the subject drop down value. i got the all three values (.field of
study, .country,location) values ,but i didn't get the subject value;
here is my code.


@$cat=$_GET['cat'];
@$one=$_GET['country'];
@$subcat=$_GET['subcat'];


?>

<SCRIPT language=JavaScript>
<!--

function reload(form)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
var cal=form.subcat.options[form.subcat.options.selectedIndex].value;


var sel=form.one.options[form.one.options.selectedIndex].value;



var params="cat="+val+"&subcat="+cal+"&country="+sel;


self.location='test.php?' + params ;


}






function disableselect()
{
<?

if(isset($cat) and strlen($cat) > 0){

echo "document.f1.subcat.disabled = false;";}
else{echo "document.f1.subcat.disabled = true;";}

if(isset($one) and strlen($one) > 0){
echo "document.f1.two.disabled = false;";}
else{echo "document.f1.two.disabled = true;";}



?>
}


</script>
</head>

<body onload=disableselect();>

<?

$quer2=mysql_query("SELECT DISTINCT     specialization FROM
collegesearch group by specialization");
///////////// End of query for first list box////////////

/////// for second drop down list we will check if specialization is
selected else we will display all the subject/////
if(isset($cat) and strlen($cat) > 0){

$quer=mysql_query("SELECT  subject FROM collegesearch where
specialization='$cat' group by subject");
}else{$quer=mysql_query("SELECT  subject FROM collegesearch group by
subject"); }
////////// end of query for second subject drop down list
box ///////////////////////////

echo "<form method=post name=f1 action='dd-check.php'>";
/// Add your form processing page address to action in above line.
Example  action=dd-check.php////
//////////        Starting of first drop downlist /////////
echo "<p>Specialization:<select name='cat' onchange=\"reload
(this.form)
\"><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['specialization']...@$cat){echo "<option selected
value='$noticia2[specialization]'>$noticia2[specialization]</
option>"."<BR>";}
else{echo  "<option value='$noticia2[specialization]'>$noticia2
[specialization]</option>";}
}
echo "</select></p>";
//////////////////  This will end the first drop down list ///////////

//////////        Starting of second drop downlist /////////
echo "<p>Subject:<select name='subcat' ><option value=''>Select one</
option>";
while($noticia = mysql_fetch_array($quer)) {
echo $noticia[subject];
echo  "<option country='$noticia[subject]'>$noticia[subject]</
option>";
}
echo "</select></p>";




$quer3=mysql_query("SELECT  DISTINCT    country  FROM collegesearch
group by country");
///////////// End of query for first list box////////////
$x="SELECT  DISTINCT    country  FROM collegesearch group by country";


/////// for second drop down list we will check if country is selected
else we will display all the state/////
if(isset($one) and strlen($one) > 0){

$quer4=mysql_query("SELECT  state FROM collegesearch where
country='$one' group by state");

$y="SELECT  state FROM collegesearch where country='$one' group by
state";
}else{$quer4=mysql_query("SELECT  state FROM collegesearch group by
state"); }
////////// end of query for second state drop down list
box ///////////////////////////

echo "<form method=post name=f1 action='dd-check.php'>";
/// Add your form processing page address to action in above line.
Example  action=dd-check.php////
//////////        Starting of first drop downlist /////////
echo "<p>country:<select name='one' onchange=\"reload(this.form)
\"><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_array($quer3)) {
if($noticia2['country']...@$one){echo "<option selected
value='$noticia2
[country]'>$noticia2[country]</option>"."<BR>";}
else{echo  "<option value='$noticia2[country]'>$noticia2[country]</
option>";}
}
echo "</select></p>";

//////////////////  This will end the first drop down list ///////////

//////////        Starting of second drop downlist /////////
echo "<p>State:<select name='two'><option value=''>Select one</
option>";
while($noticia = mysql_fetch_array($quer4)) {
echo  "<option value='$noticia[state]'>$noticia[state]</option>";
}
echo "</select></p>";






//////////////////  This will end the second drop down
list ///////////
//// Add your other form fields as needed here/////
echo "<input type=submit value=Submit>";
echo "</form>";
?>
thanks in advance.

Reply via email to