为什么activitieDropdownlist的值始终无法获取到?
本帖最后由 sincor 于 2013-06-22 18:17:19 编辑
视图层view
<br />
<br />
<form method="post"><br />
<?php echo CHtml::activeDropDownList($m_subjectlist,'subject_name',$sb_list);?><br />
<div class="row submit"><br />
<?php echo CHtml::submitButton('显示我所选择的专业'); ?><br />
</div><br />
<?php echo 'test'.$result.'111';?><br />
</form><br />
<br />
<br />
Nach dem Login kopieren
控制器层
<br />
public function actionDbdplist()<br />
{<br />
$m_subjectlist = new SubjectList();<br />
$m_gradelist = new Grade;<br />
$this->subject_list = SubjectList::model()->findAll(); <br />
$this->grade_list = Grade::model()->findAll(); <br />
//使用findAll 得到的结果是数据对象所以这样小小处理一下吧他们转换成数组:<br />
foreach($this->subject_list as $item)<br />
{<br />
$sb_list[$item->subject_id] = $item->subject_name;<br />
}<br />
foreach($this->grade_list as $item)<br />
{<br />
$gd_list[$item->grade_id] = $item->grade_name;<br />
}<br />
<br />
<br />
<br />
$result=$_POST['subject_name'];<br />
<br />
<br />
$this->render('dbdplist',array(<br />
'm_subjectlist' => $m_subjectlist,<br />
'm_gradelist' => $m_gradelist,<br />
'subject_list'=>$this->subject_list,<br />
'grade_list'=>$this->grade_list,<br />
'sb_list'=>$sb_list,<br />
'gd_list'=>$gd_list,<br />
'result'=>$result,<br />
'model'=>$model,));<br />
<br />
}
Nach dem Login kopieren