求thinkphp下实现下拉框三级分类联动~~!!!

数据库使用一个表来实现这个功能
2025-01-05 10:11:41
推荐回答(3个)
回答1:

/**
*desc 卫生纪律考核
*author 陈晨
*date 2012/12/17
*/
class HeadisAction extends Action {
/*
* 卫生纪律考核首页
*/
public function ru_headis() {
$this->display ();
}
/*
* 个人卫生纪律考核
*/
public function person() {
//查询年级
$grade = M ( 'sy_grade' );
$check = M('sy_headis');
$g_list = $grade->select ();
//查出考核情况
$ch_list = $check->select();
//dump($g_list);
$this->assign ( 'g_list', $g_list );
$this->assign ( 'ch_list', $ch_list );
$this->display ( 'ru_headis_person' );

}
/*
* 根据年级查出班级
*/
public function gra_class() {

$class = M('sy_class');
$c_list = $class->where('c_gId ='.$_GET['grade'])->select();
//dump($c_list);
$string = '';
for($i = 0; $i < count ( $c_list ); $i ++) {
$string = $string. "";
}
echo $string;

}
/*
* 根据班级查出学生
*/
public function cla_stu(){
$student = M('stu_student');
$s_list = $student->where('s_cId ='.$_GET['class'])->select();
$string = '';
for($i = 0; $i < count ( $s_list ); $i ++) {
$string = $string. "";
}
echo $string;
}
/*
* 根据考核查询分数
*/
public function checkscore(){

$score = M('sy_headis');
$check = $score->where('h_Id ='.$_GET['score'])->find();
echo $check['h_Score'];
}

}


模板



















border=0>









src="__PUBLIC__/images/new_022.jpg" border=0>




当前位置: 一日常规管理 > 卫生纪律管理 > 个人卫生纪律管理

align=center border=0 >
















































个人卫生纪律考核
年级:
班级:
学生姓名:
考核情况:

加分:
日期:

  
  


src="__PUBLIC__/images/new_023.jpg" border=0>






height=15> border=0>

回答2:

标记父ID,然后用ajax实现三级联动

回答3:

用ajax就是啦