[SOLVED] AC/ Disabled

Hi

In my va i have a form to bid a flight where pilot choose a AC , FL insert a route etc ..

My code to choose a AC is -

<select name=“aircraft”><?php foreach($aircraft as $ac) { if($ac->id == $route->aircraft) { $sel1 = “selected”; } else { $sel1 = “”; } ?><option value=“<?php echo $ac->id ?>” <?php echo $sel1 ?>><?php echo $ac->name.’ - '.$ac->registration; ?></option><?php } ?></select>

What i want is change code so disabled aircrafts will not show.

Thank You in advance

Try this

<select name="aircraft">
<?php
foreach($aircraft as $ac) {
if($ac->id == $route->aircraft) {
 $sel1 = "selected";
} else {
 $sel1 = "";
}

if($ac->enabled == '0') {
 continue;
}

echo '<option value="'.$ac->id.'" '.$sel1.'>'.$ac->name.' - '.$ac->registration.'</option>';
}
?>
</select>
1 Like

Try this

Work’s great , thank you so much