为什么activitieDropdownlist的值始终无法获取到?

WBOY
Release: 2016-06-23 14:13:47
Original
820 people have browsed it

本帖最后由 sincor 于 2013-06-22 18:17:19 编辑

视图层view

<form method="post">          <?php echo CHtml::activeDropDownList($m_subjectlist,'subject_name',$sb_list);?> <div class="row submit">     <?php echo CHtml::submitButton('显示我所选择的专业'); ?> </div> <?php  echo 'test'.$result.'111';?> </form>
Copy after login



控制器层

	public function actionDbdplist()	{    $m_subjectlist = new SubjectList();    $m_gradelist = new Grade;    $this->subject_list = SubjectList::model()->findAll();     $this->grade_list = Grade::model()->findAll();                                         	//使用findAll 得到的结果是数据对象所以这样小小处理一下吧他们转换成数组:    foreach($this->subject_list as $item)	{         $sb_list[$item->subject_id] = $item->subject_name;    }    foreach($this->grade_list as $item)	{         $gd_list[$item->grade_id] = $item->grade_name;    }	$result=$_POST['subject_name'];	    $this->render('dbdplist',array(               'm_subjectlist' => $m_subjectlist,               'm_gradelist' => $m_gradelist,               'subject_list'=>$this->subject_list,               'grade_list'=>$this->grade_list,               'sb_list'=>$sb_list,               'gd_list'=>$gd_list,               'result'=>$result,		'model'=>$model,));			   }	
Copy after login

回复讨论(解决方案)

看一下 CHtml::activeDropDownList 的定义

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template