下拉框选中后默认为选中状态

<td ><select id="pri_sel_'.$v['id'].'">
<option value="1">随机</option>';
                                if($v['rid']){
                                    $selete = '';
                                    foreach($prizelist as $key=>$val){
                                        if($v['rid'] == $val['id']){
                                            $selete = 'selected';
                                        }else{
                                            $selete = '';
                                        }
                                        echo '

                                        <option value="'.$val['id'].'" '.$selete.' >'.$val['pname'].'</option>';
                                    }
                                }else{
                                    foreach($prizelist as $key=>$val){
                                        echo '<option value="'.$val['id'].'">'.$val['pname'].'</option>';
                                    }
                                }

                        echo    '</select></td>

 

posted @ 2016-01-07 15:04  FinnYY  阅读(1231)  评论(0编辑  收藏  举报