First, you need to store all the aircraft types soemwhere useful, not in your data table. So either create an array for them, or better yet, store them in thier own table.
aircraftTypeId INT (10) NOT_NULL AUTO_INCREMENT PK
aircraftTypeName VARCHAR (50) NOT_NULL UNIQUE
Then another table to store tail numbers of similar make up.
I honestly wish i could share what I have on this, I am the web development manager for a large aviation company and we have this already built and containging close to about 55K airframes and over 400 types.
Code:
$queryAircraftType = "select * from aircraftType order by aircraftTypeName";
$resultAircraftType = mysql_query($queryAircraftType) or die ("couldn't execute query.");
print("<select name=\"AircraftType\" id=\"AircraftType\" onchange=\"form.submit();\">");
while($rowAircraftType = mysql_fetch_array($resultAircraftType)) {
if($rowAircraftType['aircraftTypeId']==$_GET['AircraftType']){ $s = "selected"; }
else { $s = ''; }
print("<option $s value='$rowAircraftType[aircraftTypeId]'>$rowAircraftType[AircraftTypeName]</option>;"}
//Using <BR> inside of a select is not valid HTML
}
?>
print("</select>");
second drop down list populated from initial drop down
//USE a good dropdown selector like:
http://www.mattkruse.com/javascript/dynamicoptionlist/
Display results within table
CODE
Code:
<?php
$queryAircraftTypeDisplay = "SELECT *.r, a.aircraftTypeName from report r left join aircraftTypeId a on (r.aircraftTypeId = a.aircraftTypeId) where aircraftTailNo='".$_GET['AircraftTailNo']."'";
$resultAircraftTypeDisplay = mysql_query($queryAircraftTypeDisplay) or die ("couldn't execute query ".mysql_error());
while ($row = mysql_fetch_array($resultAircraftTypeDisplay))
{
echo "<tr>
<td>$_GET[AircraftTailNo]</td>
<td>$row[ReportID]</td>
<td>$row[AircraftTailNo]</td>
<td>$row[AircraftTypeName]</td>
<td>$row[ServicingType]</td>
<td>$row[AirFrameHours]</td>
<td>$row[DefectInfo]</td>
<td>$row[Rectifications]</td>
<td>$row[Comments]</td>
<td>$row[RelatedDoc]</td>
<td>$row[UserID]</td>
</tr>";
}
?>