Jump to content

Recommended Posts

Posted

I am trying to add 5 new fields to the "add aircraft" page in the admin sections, the database table has the new fields and I think that I have done the code right

but its not adding any of the data to the new fields when I press 'Edit aircraft' and would like your help

My code is as follows:

<h3><?php echo $title;?></h3>
<p>* Denotes required fields</p>
<form action="<?php echo adminurl('/operations/aircraft');?>" method="post">
<dl>
<dt>* Aircraft ICAO Code</dt>
<dd><input name="icao" type="text" value="<?php echo $aircraft->icao; ?>" /></dd>
<dt>* Aircraft Name/Type (i.e B747-400)</dt>
<dd><input name="name" type="text" value="<?php echo $aircraft->name; ?>" /></dd>
<dt>* Full Name (Boeing 747-400 Combi)</dt>
<dd><input name="fullname" type="text"  value="<?php echo $aircraft->fullname; ?>" /></dd>
<dt>* Aircraft Registration</dt>
<dd><input name="registration" type="text"  value="<?php echo $aircraft->registration; ?>" />
<p>TIP: Place an X in the registration to denote an inactive aircraft</p>
</dd>
<dt>* Maximum Passengers</dt>
<dd><input name="maxpax" type="text"  value="<?php echo $aircraft->maxpax; ?>" />
<p>The maximum number of passengers that can be flown on this aircraft, for passenger or charter flights</p>
</dd>
<dt>* Maximum Cargo</dt>
<dd><input name="maxcargo" type="text"  value="<?php echo $aircraft->maxcargo; ?>" />
<p>The maximum cargo load of this aircraft in <?php echo Config::Get('CARGO_UNITS'); ?>, for cargo flights</p>
</dd>
<dt>Link to download aircraft</dt>
<dd><input name="downloadlink" type="text"  value="<?php echo $aircraft->downloadlink; ?>" /></dd>
<dt>Link to aircraft image</dt>
<dd><input name="imagelink" type="text"  value="<?php echo $aircraft->imagelink; ?>" /></dd>
<dt></dt>
<dd>Some of this aircraft can be retrieved from <a href="http://www.airliners.net/aircraft-data/" target="_new">this site</a>.</dd>
<dt>Range</dt>
<dd><input name="range" type="text"   value="<?php echo $aircraft->range; ?>" /></dd>
<dt>Maximum Take off weight</dt>
<dd><input name="MaxTOW" type="text" value="<?php echo $aircraft->MaxTOW; ?>" />
	   <p>The maximum Take Off Weight for this aircraft in <?php echo Config::Get('CARGO_UNITS'); ?></p>
</dd>
<dt>Maximum Zero fuel weight</dt>
<dd><input name="MaxZFW" type="text" value="<?php echo $aircraft->MaxZFW; ?>" />
	   <p>The maximum Zero Fuel Weight for this aircraft in <?php echo Config::Get('CARGO_UNITS'); ?></p>
</dd>
<dt>Cruise Level</dt>
<dd><input name="cruiselevel" type="text"  value="<?php echo $aircraft->cruiselevel; ?>" />
	   <p>The maximum cruising altitude in feet</p></dd>
<dt>Cruise Speed</dt>
<dd><input name="cruisespeed" type="text"  value="<?php echo $aircraft->cruisespeed; ?>" />
	   <p>The maximum cruising speed in Mach</dd>

<dt>Cost Index</dt>
<dd><input name="ci" type="text" value="<?php echo $aircraft->ci; ?>" />
	   <p>The typical cost index for the aircraft</p></dd>
<dt>Minimum Rank Required to fly</dt>
<dd>
<select name="minrank">
 <option value="0" <?php if($aircraft->minrank == 0){ echo 'selected'; } ?>>None</option>
 <?php
 foreach($allranks as $rank)
 {
  if($aircraft->minrank == $rank->rankid)
$sel = 'selected="selected"';
  else
$sel = '';

  echo "<option value=\"{$rank->rankid}\" {$sel} >{$rank->rank}</option>";
 }
 ?>
</select>
</dd>
<dt>Enabled?</dt>
<?php $checked = ($aircraft->enabled==1 || !$aircraft)?'CHECKED':''; ?>
<dd><input type="checkbox" id="enabled" name="enabled" value="1" <?php echo $checked ?> /></dd>

<dt></dt>
<dd><input type="hidden" name="id" value="<?php echo $aircraft->id;?>" />
<input type="hidden" name="action" value="<?php echo $action;?>" />
<input type="submit" name="submit" value="<?php echo $title;?>" />
</dd>
</dl>
</form>

  • Moderators
Posted

You need to add those fields in the function that inserts data into the DB. I believe its in the modules/Aircraft not sure though.

  • Moderators
Posted

Also, have a look into the OperationsData.class.php and look for the function where it adds the aircraft and edits the aircraft.

You'll probarly understand it from there.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...