日期:2014-05-16 浏览次数:20594 次
<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>
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,));
}