Home > Backend Development > PHP Tutorial > 打击回看看,为什么post过来的数据为空

打击回看看,为什么post过来的数据为空

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:10:52
Original
1162 people have browsed it

打击来看看,为什么post过来的数据为空

<br /><form method="post" action="/Thinkphp/admin.php/User/do_login" id="form1" name='form1'><br />            <div class="container"><br />                <div class="content"><br />                    <div class="bt"><h1>WELCOME</h1><span>即将进入后台管理系统……</span></div><br />                    <div class="logo"></div><br />                    <div class="name"><br />                        <ul><br />                            <li><span>用户名:</span><input name="txtUserName" type="text" id="txtUserName" class="login_input required" /></li><br />                            <li><span>密  码:</span><input name="txtUserPwd" type="password" id="txtUserPwd" class="login_input required" /></li><br />                            <li class="yzm"><span>验证码:</span><input name="txtCode" type="text" maxlength="6" id="txtCode" class="login_input required" /><br />                                   <br />                                <img src="/Thinkphp/momuadmin.php/Public/code"   alt="点击切换验证码" title="点击切换验证码"   style="max-width:90%"onclick="ToggleCode(this, '/Thinkphp/momuadmin.php/Public/code');<br />                                        return false;"  /><br />                            </li><br />                        </ul><br />                        <div class="ok"><br />                            <input type="submit" name="btnSubmit" value="登 录" id="btnSubmit" class="login_btn" /><br/><br />                        </div><br/><br />                    </div><br />                </div><br />            </div><br />            <div class="footer"><br />                <div class="footbox">Copyright 1998 - 2013 MOMU. All Rights Reserved. <a href="#target="_blank" style="color:#FFF;"</a> 版权所有</div><br />            </div><br />            </div><br />        </form><br />
Copy after login


<br /> public function do_login() {<br />        $username = $_POST['txtUserName'];<br />        $userpwd = $_POST['txtUserPwd'];<br />        $code = $_POST['txtCode'];<br />        if ($code==$_SESSION['verify']) {<br />            $m = M('Manger');<br />            $where['username'] = $username;<br />            $where['userpwd'] = md5($userpwd);<br />            $i = $m->where($where)->count();<br />            if ($i > 0) {<br />                $this->redirect(__URL__ / main);<br />            } else {<br />                $this->error('用户名或密码错误');<br />            }<br />        } else {<br />            var_dump($_POST).'</br>';<br />            //var_dump($_SESSION['verify']);<br />            //$this->error('验证码错误');<br />        }<br />    }<br /><br />
Copy after login



每次都是$_post为空,求教这是为什么
------解决思路----------------------
代码没有问题在if里面echo['txtUserName']
在else里面echo['txtUserPwd']看看输出什么
------解决思路----------------------
<div class="footbox">Copyright 1998 - 2013 MOMU. All Rights Reserved. <a href="#target="_blank" style="color:#FFF;"</a> 版权所有</div>
Copy after login

这里修改为
<div class="footbox">Copyright 1998 - 2013 MOMU. All Rights Reserved. <a href="#" target="_blank" style="color:#FFF;"></a> 版权所有</div>
Copy after login


起了两个文件测试,是可以post并接收数据的。





WELCOME

即将进入后台管理系统……




  • 用户名:

  • 密 码:

  • 验证码:

    点击切换验证码













Copy after login


server.php
<br /><?php<br />$username = $_POST['txtUserName'];<br />$userpwd = $_POST['txtUserPwd'];<br />$code = $_POST['txtCode'];<br /><br />echo $username;<br />echo $userpwd;<br />echo $code;<br />?><br />
Copy after login

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template