如何选中下拉列表框

<tr>
<td class="label">上级分类:</td>
<td>
<select name="parent_id">
<option value="0">顶级分类</option>
<?php foreach($cates as $cate): ?>
<option value="<?php echo $cate['cat_id']; ?>"
<?php echo $cate['cat_id']==$cates_data[0]['parent_id'] ?'selected' : ''; ?>
>
<?php echo str_repeat('&nbsp;',$cate['level']*2); ?>
<?php echo $cate['cat_name'];?>
</option>
<?php endforeach;?>
</select>
</td>
</tr>

posted @ 2014-04-15 14:33  麦田守望者~  阅读(148)  评论(0编辑  收藏  举报