php 输入用户名和联系电话 查找用户数据

来源:互联网 发布:软件企业会计处理 编辑:程序博客网 时间:2024/04/28 06:40
  <!-- 报名查询填写信息 -->                    <form action="{:U('Home/Index/baomingXinxi')}" class="from" method="post" id="from">                        <p class="fix">                            <label class="word word1"></label>                            <input type="text" class="text" name="name" id="name">                        </p>                        <p class="fix">                            <label class="word word4"></label>                            <input type="text" class="text" name="mobile" id="mobile">                        </p>                    </form>                    <!-- 按钮 -->                    <div class="butBox fix">                        <a href="javascript:;" class="butLeft" id="btn"></a>                        <a href="{:U('Home/Index/baomingFrom')}" class="butRight"></a>                    </div>//js验证部分    $('#btn').click(function(){        var  name =$.trim($("#name").val());        var  mobile =$.trim($("#mobile").val());        if(name == ''){            $('#errorNotice').html("姓名不能为空");            $('.ly_mask').removeClass('none');        }else if(mobile == ''){            $('#errorNotice').html("联系电话不能为空");            $('.ly_mask').removeClass('none');        }else{            $.post("{:U('Home/Index/baomingChaxun')}",{name:name,mobile:mobile},function(data){                if(data.status==1){                    $('#from').submit();                }else{                    $('#errorNotice').html("用户信息不存在");                    $('.ly_mask').removeClass('none');                }            })        }    });//php处理    function baomingChaxun(){        $UserModel = M('user');        if(isset($_POST['name'])&&isset($_POST['mobile'])) {            $where['name'] = I('post.name');            $where['mobile'] = I('post.mobile');            $count = $UserModel->where($where)->count();            if($count>0){                $this->success();            }else{                $this->error();            }        }else{            $this->display();        }    }    function yanz(){        if(IS_AJAX){        }    }    function baomingXinxi(){        $UserModel = M('user');        if(isset($_POST['name'])&&isset($_POST['mobile'])) {            $where['name'] = I('post.name');            $where['mobile'] = I('post.mobile');            $user_info = $UserModel->where($where)->find();            $this->assign('data',$user_info);            $this->display();        }    }

0 0
原创粉丝点击