<h3><?php echo $action ?> Tour</h3>
<form method="POST" action="<?php echo SITE_URL ?>/admin/index.php/tourcenter/newstep1">
<table width="100%">
<tr><td colspan="2" align="center" style="border-bottom:1px solid #000000;">----- Required Values -----</td></tr>
<tr><td>Tour Title:</td><td><input type="text" name="tourtitle" value="<?php echo $tour->tourtitle ?>" required /></td></tr>
<tr><td>Tour Image URL:</td><td><input type="text" name="tourimage" value="<?php echo $tour->tourimage ?>" /></td></tr>
<tr><td>Tour Description:</td><td><textarea id="editor" name="tourdescription"><?php echo $tour->tourdescription ?></textarea></td></tr>
<tr><td>Open for Booking From (Date YYYY-MM-DD):</td><td><input type="date" name="startdate" value="<?php echo $tour->startdate ?>" required/></td></tr>
<tr><td>Open for Booking Until (Date YYYY-MM-DD / leave empty for unlimited):</td><td><input type="date" name="enddate" value="<?php echo $tour->enddate ?>" /></td></tr>
<tr><td>Airline Code for Tour:</td><td>
<select name="airline">
<?php if($airlines) foreach($airlines as $airline) { if($airline->code == $tour->airline) { $sel3 = "selected"; } ?>
<option value="<?php echo $airline->code ?>" <?php echo $sel3 ?>><?php echo $airline->code ?> - <?php echo $airline->name ?></option>
<?php } ?>
</select></td></tr>
<tr><td>Aircraft allowed for Tour:</td><td>
<select name="allowedaircraft[]" multiple>
 <?php 
                         $selac = explode(':', $tour->allowedaircraft);

                         foreach($aircraft as $ac) { 
                      
                         if (in_array($ac->icao, $selac)) { $sel4 = 'selected'; }
                      
                        ?>
<option value="<?php echo $ac->icao ?>" <?php echo $sel4 ?>><?php echo $ac->name ?></option>
<?php } ?>
</select></td></tr>
<tr><td>First Leg Departure Airport:</td><td>
<select name="firstdep">
<?php if($airports) foreach($airports as $apt) { if($apt->icao == $tour->firstdep) { $sel5 = "selected"; } ?>
<option value="<?php echo $apt->icao ?>" <?php echo $sel5 ?>><?php echo $apt->icao ?> - <?php echo $apt->name ?></option>
<?php } ?>
</select></td></tr>
<tr><td>Last Leg Arrival Airport:</td><td>
<select name="lastarr">
<?php if($airports) foreach($airports as $apt) { if($apt->icao == $tour->lastarr) { $sel6 = "selected"; } ?>
<option value="<?php echo $apt->icao ?>" <?php echo $sel6 ?>><?php echo $apt->icao ?> - <?php echo $apt->name ?></option>
<?php } ?>
</select></td></tr>
<tr><td>Number of Tour Legs:</td><td><input type="text" name="legnumber" value="<?php echo $tour->legnumber ?>" required /></td></tr>
<tr><td>Tour Status:</td><td>
<select name="status">
<option value="0">Hidden</option>
<option value="1">Active</option>
<option value="2">Upcoming</option>
<option value="3">Closed</option>
</select></td></tr>
<tr><td colspan="2" align="center" style="border-bottom:1px solid #000000;">----- Optional Values -----</td></tr>
<tr><td>Max number of Pilots who can sign up for this tour:</td><td><input type="text" name="maxsignups" value="<?php echo $tour->maxsignups ?>" /></td></tr>
<tr><td>Maximum days a pilot has to complete the tour after booking:</td><td><input type="text" name="maxdays" value="<?php echo $tour->maxdays ?>" /></td></tr>
<tr><td>Rank Limit:</td><td>
<select name="minrank">
<option value="0">No Limit</option>
<?php if($ranks) foreach($ranks as $rank) { if($rank->rankid == $tour->minrank) { $sel1 = "selected"; } ?>
<option value="<?php echo $rank->rankid ?>" <?php echo $sel1 ?>><?php echo $rank->rank ?></option>
<?php } ?>
</select></td></tr>
<tr><td>Pilot must have completed the following Tour(s) before he can sign up for this tour:</td><td>
<select name="requiredtours[]" multiple>
<option value="">No Tours Required</option>
 <?php 
                         $seltour = explode(':', $tour->requiredtours);

                         foreach($tours as $listour) { 
                      
                         if (in_array($listour->id, $seltour)) { $sel2 = 'selected'; }
                      
                        ?>
<option value="<?php echo $listour->id ?>" <?php echo $sel2 ?>><?php echo $listour->tourtitle ?></option>
<?php } ?>
</select></td></tr>
<tr><td>Auto Issue Award:</td><td>
<select name="autoaward">
<option value="0">No</option>
<option value="1">Yes</option>
</select></td></tr>
<tr><td>Award Image URL:</td><td><input type="text" name="awardimage" value="<?php echo $tour->awardimage ?>" /></td></tr>
<tr><td></td><td>
<input type="hidden" name="action" value="<?php echo $action ?>" />
<input type="submit" name="submit" value="<?php echo $action ?> Tour | Next Step" /></td></tr>
</table>
</form>