<h3>Transfer Pilots</h3>
<table width="100%" class="tablesorter">
<thead>
<tr>
<th>Pilotid</th>
<th>Name</th>
<th>Current Location</th>
<th>Transfer To</th>
<th>Confirm</th>
</tr>
</thead>
<?php
if($pilots)
foreach($pilots as $data)
{
	$pilotloc = FlightSearchData::getpilotscurrentlocation($data->pilotid);
?>
<tr>
<td><?php echo $data->code.$data->pilotid ?></td>
<td><?php echo $data->firstname ?> <?php echo $data->lastname ?></td>
<td><?php if($pilotloc) { $deplocation = $pilotloc->location; ?> 
<?php echo $pilotloc->location ?> <?php echo $pilotloc->name ?>
<?php } else { $deplocation = $data->hub; ?><?php echo $data->hub ?> - <?php echo FlightSearchData::getairportname($data->hub) ?>
<?php } ?></td>
<form id="<?php echo $data->code.$data->pilotid ?>" name="<?php echo $data->code.$data->pilotid ?>" action="<?php echo adminurl('/flightsearch/transferpilot'); ?>" method="post">
<td><select name="newlocation">
<?php if($airports)
foreach($airports as $apt)
{ 
if(!$apt->depicao)
{ continue; }?>
<option value="<?php echo $apt->depicao ?>" <?php echo $sel1 ?>><?php echo $apt->depicao ?> - <?php echo $apt->depname ?></option>
<?php } ?>
</select></td>
<td>
<input type="hidden" name="pilotid" value="<?php echo $data->pilotid ?>" />
<input type="submit" value="Transfer Pilot" /></td>
</form>
</tr>
<?php } ?>
</table>
<script>
$(document).ready(function(){
    $(this).scrollTop(0);
});
</script>