zoukankan      html  css  js  c++  java
  • 多年级勾选

        function updatenews(){
            $id=I("id");
            $data=M("series")->find($id);
            
            //调取年级
            $grade=M('activity_grade')->where("1")->order("id asc")->select();
            $this->assign("grade",$grade);
      
        
            $activity_inner= M('activity_grade_map')->field("grade_id")->where(array('activity_id' => $id,'type'=>'2'))->select();
            
     
            foreach($activity_inner as $key=>$value) {
                 $grades[] = $value["grade_id"];
            }
           
            
            $this->assign("grades",$grades);
            
            $this->assign("data",$data);
            $this->display();
        }

    <div class="control-group">
                        <label class="control-label">{:L('适合年级')}</label>
                        <div class="controls">
                          <label>
                          
                          
                          <volist name="grade" id="item" key="key" >
                            <input name="grade_id[]" type="checkbox" id="grade_id[]" value="{$item.id}" <?php if(in_array($item['id'], $grades)) { echo "checked";} ?> >
                        
                          {$item.name}&nbsp;&nbsp;
                            
                            </volist>
                            
                          </label>
                        
                        </div>
                    </div>

  • 相关阅读:
    python——数据库操作
    【笔试】T实习生2014 总结
    【JS】Intermediate6:jQuery
    【JS】Intermediate5:Scope
    【JS】Intermediate4:JSON
    【JS】Intermediate3:AJAX
    【JS】Intermediate2:Events and Callbacks
    【JS】Intermediate1:The DOM
    【JS】Beginner9:Arrays
    【JS】Beginner8:Objects
  • 原文地址:https://www.cnblogs.com/wlfozu/p/7905555.html
Copyright © 2011-2022 走看看