如何根据他的id禁用用户名?

时间:2016-05-17 13:17:31

标签: cakephp-2.0

如何根据他的ID禁用用户名?如果我添加禁用它将禁用所有数组而不只是一个值。如何禁用数组中的单个值?

              <div class="row">
             <?php foreach($userslist as  $user){ ?>
              <div class="col-xs-3">
              <select class="form-control" disabled>
                <option><?=$user['User']['username'];?><option>

              </select>
            </div><?php } ?>
            </div>`

2 个答案:

答案 0 :(得分:0)

使用if语句

var query = db.Cars.Where(m => m.Locations.Any()).Include(m => m.Locations);

答案 1 :(得分:0)

<div class="row">
<?php foreach($userslist as  $user){ ?>
 <div class="col-xs-3">
 <select class="form-control">
    <?php if($user['User']['username'] == 'XXX'){?>
        <option disabled><?=$user['User']['username'];?><option>
    <?php } else { ?>
        <option ><?=$user['User']['username'];?><option>
    <?php } ?>
 </select>
</div><?php } ?>
</div>