Get the cond of second query from the first query instead of Drop Down..
Try this out!
<form method="get" name="search">
<select name="AircraftType" id="AircraftType" onchange="form.submit();">
<?php
$resultAircraftType = mysql_query('SELECT DISTINCT AircraftType FROM aircraftinfo order by AircraftType')
or die('the Query is failed: ' . mysql_error());
//Build the Drop Down for the first record ...
$rowAircraftType = mysql_fetch_array($resultAircraftType);
$first_row=$rowAircraftType['AircraftType']; // Keep the first row just in case of first loading..
if($rowAircraftType['AircraftType']==$_GET['AircraftType'])
{
echo "<option selected value='$rowAircraftType[AircraftType]'>$rowAircraftType[AircraftType]</option>"."<BR>";}
else
{
echo "<option value='$rowAircraftType[AircraftType]'>$rowAircraftType[AircraftType]</option>";
}
//--end of first record..
while($rowAircraftType = mysql_fetch_array($resultAircraftType)) {
if($rowAircraftType['AircraftType']==$_GET['AircraftType'])
{
$first_row=$rowAircraftType['AircraftType'];//change the value if GET exists
echo "<option selected value='$rowAircraftType[AircraftType]'>$rowAircraftType[AircraftType]</option>"."<BR>";}
else
{
echo "<option value='$rowAircraftType[AircraftType]'>$rowAircraftType[AircraftType]</option>";}
}
?>
</select>
<?php
//if (isset($_GET['AircraftType']))
//{
$queryAircraftTailNo = "SELECT AircraftTailNo FROM aircraftinfo where aircrafttype='".
$first_row."'"; //Get the cond from the query instead of Drop Down..
//echo $query;
$resultAircraftTailNo =mysql_query($queryAircraftTailNo)
or die ("couldn't execute query ".mysql_error());
if ($resultAircraftTailNo)
{
echo "<select name=\"AircraftTailNo\">";
while ($rowAircraftTailNo = mysql_fetch_array($resultAircraftTailNo))
{
if($rowAircraftTailNo['AircraftTailNo']==$_GET['AircraftTailNo'])
{
echo "<option selected value='$rowAircraftTailNo[AircraftTailNo]'>$rowAircraftTailNo[AircraftTailNo]</option>"."<BR>";}
else
{
echo "<option value='$rowAircraftTailNo[AircraftTailNo]'>$rowAircraftTailNo[AircraftTailNo]</option>";}
}// end of while
//}// end of if}
?>
it can be tested here:
http://gms.locatehomes.com/aircraft.php will be removed in 2 days..