aerofrag Posted June 8, 2012 Report Share Posted June 8, 2012 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> Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted June 9, 2012 Moderators Report Share Posted June 9, 2012 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. Quote Link to comment Share on other sites More sharing options...
aerofrag Posted June 10, 2012 Author Report Share Posted June 10, 2012 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. Thanks! I'll give it a go Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted June 11, 2012 Moderators Report Share Posted June 11, 2012 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.