thinkphp

WBOY
Release: 2016-06-23 13:47:08
Original
959 people have browsed it

为什么if标签判断的不能起作用??求解,在线等

public function editestudent(){
$db=M('students');

if(IS_POST){

$stu_id=I('stu_id');
$stu_name=I('stu_name');
$cla_id=I('cla_id');
$data=array('stu_name'=>I('stu_name'),'cla_id'=>I('cla_id'));
$id=$db->data($data)->where('stu_id='.$stu_id)->save();
if($id){
$this->success('学生修改成功','liststudent');
}else{
$this->error('学生修改失败');
}

}else{
$stu_id=I('stu_id');
$arr=$db->find($stu_id);
//dump($arr);
$this->assign('array',$arr);

$n=M('classs');
$arra=$n->select();
//dump($arra);
$this->assign('edite',$arra);
$this->display();
}






nbsp;html public "-//w3c//dtd html 4.0 transitional//en">


 New Document 

<script> <br /> function checkform(f){ <br /> if(f.cla_name.value==""){ <br /> alert("学生姓名名不能为空!"); <br /> return false; <br /> }else{ <br /> return true; <br /> } <br /> <br /> } <br /> </script> 


















学生姓名
        

学生班级








回复讨论(解决方案)

看标签没问题。
可以打印出$v.cla_id eq $array.stu_id 看看是否相等。

输出比较的数组和变量的值看看。

Related labels:
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