zoukankan      html  css  js  c++  java
  • yii表单

                 

        yii  的dropdownlist,用yii的session可以记下选中的状态

         

          $form = $this->beginWidget('CActiveForm',array('action'=>$this->CreateUrl('exchange/search')));
          ?>
                		<div id='add'><span style='font-size:1.2em;margin-right:10px;'>类型:</span>
                		<?php 
                		    $check=Yii::app()->session['check'];
                		   // echo $check;die;
                		   echo $form->dropDownList($loginForm,'check',array('0'=>'未通过','1'=>'通过','2'=>'拒绝'),
                				array('style'=>'margin-right:30px;100px;height:30px','placeholder'=>'用户id',
                              'options'=>array($check=>array('selected'=>true))))?>
                		
                		<input type='submit' name='search' value='查询' class='btn btn-success'>
                		 </div>
                	<?php
                $this->endWidget();
    

      

     yii表单2

           

    <?php $form=$this->beginWidget('CActiveForm')?>
             <table style="540px;margin-top:1%;">
              <tr style="text-align:center; background-color:#198ef0;color:white;">
                   <td style="font-size:1.3em;height:30px;">添加</td>
              </tr>
    
              <tr>
                <td><span style="display:inline-block;100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">用户名: </span><?php echo  $form->textField($user,'username')?></td>
               </tr>
               <tr>
                 <td><span style="display:inline-block;100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">邮箱: </span><?php echo $form->textField($user,'email')?></td>
               </tr>
          	   <tr>
                 <td><span style="display:inline-block;100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">密码: </span><?php echo $form->passwordField($user,'password')?></td>
               </tr>
               <tr>
                 <td><span style="display:inline-block;100px;margin-left:100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">角色选择: </span>
                 <?php $roles=array('0'=>'医生','2'=>'老师','3'=>'军人','4'=>'动漫','5'=>'通话');echo $form->checkBoxList($user,'roles[]',$roles,array('separator'=>' ','style'=>'display:inline-block;'));?></td>
               </tr>
               <tr>
                  <td style="padding-top:5px;padding-bottom:5px;"><input type="submit" name="edit"  style="100px;" class="btn btn-primary" value="添加"></td>
          	   </tr>
          	 </table>
      	<?php $this->endWidget()?>
    

       其中checkbox横排显示可以在style中加入display:inline-block

         

  • 相关阅读:
    FTP上传下载使用ASCII与binary的区别
    was日志报检测到cpu饥饿
    AIX的inittab配置文件解释
    启动和停止 IBM HTTP Server
    阿里云 centos7 设置python2 与 python3 并存
    股票---逢9必涨!华为男卖4套房炒股,2019年不能错过?
    看了电影,万箭穿心
    今天是来cnblog的第一天,值得纪念哈^v^
    函数
    集合( set )
  • 原文地址:https://www.cnblogs.com/xshang/p/3901519.html
Copyright © 2011-2022 走看看