Select usando if/else ternário

<?php $status=3; ?>
<select name="status">
 <option <?php echo $selected = ($status == '1') ? 'selected="selected"' : ''; ?>>1 - Aguardando</option>
 <option <?php echo $selected = ($status == '2') ? 'selected="selected"' : ''; ?>>2 - Aceito</option>
 <option <?php echo $selected = ($status== '3') ? 'selected="selected"' : ''; ?>>3 - Rejeitado</option>
</select>

Deixe uma resposta