Jump to content

[SOLVED] AC/ Disabled


Kapitan

Recommended Posts

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

Edited by Kapitan
Link to comment
Share on other sites

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>

  • Like 1
Link to comment
Share on other sites

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>

Work's great , thank you so much

Edited by Kapitan
Link to comment
Share on other sites

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...