Kapitan Posted November 15, 2016 Report Posted November 15, 2016 (edited) 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 November 18, 2016 by Kapitan Quote
web541 Posted November 15, 2016 Report Posted November 15, 2016 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 Quote
Kapitan Posted November 15, 2016 Author Report Posted November 15, 2016 (edited) 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 November 15, 2016 by Kapitan Quote
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.