$ _POST不传递任何变量 [英] $_POST not passing any variables

查看:134
本文介绍了$ _POST不传递任何变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的一个新项目构建一个高级登录系统,但是我遇到的问题是最简单的部分。发布的表单数据。



下面的页面之间没有传输数据。我已经过了一个小时,我找不到任何问题。



请大家帮忙,谢谢。



代码和注释

login.php:

 <!DOCTYPE html> 
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title> Live Home ::客户登入< / title>

< link rel =stylesheethref =css / core.core.csstype =text / css/>
< script src =http://code.jquery.com/jquery.min.jstype =text / javascript>< / script>
< script src =js / common.jstype =text / javascript>< / script>
< script src =bundles / bootstrap / js / bootstrap.min.jstype =text / javascript>< / script>
< / head>

< body>

< header>
< div class =bar>< / div>
< div class =btm>< / div>
< / header>


< section id =login>
< div class =drop>
< div class =top>
< h2> Live Home< / h2>
< hr class =sec-sepstyle =width:100px; />
< / div>
< section id =FOH>
< div class =inner>
< form class =form-horizo​​ntalmethod =postid =logon-formaction =auth / logon.php>
< div class =control-group>
< label class =control-labelfor =inputEmail>用户名/电子邮件地址:< / label>
< div class =controls>
< input type =textid =inputEmailplaceholder =用户名/电子邮件地址/>
< / div>
< / div>
< div class =control-group>
< label class =control-labelfor =inputPassword>密码:< / label>
< div class =controls>
< input type =passwordid =inputPasswordplaceholder =Password/>
< / div>
< / div>
< div class =control-group>
< / div>
< / form>
< / div>
< div class =login-loader>< / div>
< / section>
< / div>
< / section>

< script type =text / javascript>

$(window).bind('load resize',setPos);
$ b函数setPos(){
$('#login')。css({$ b $'margin-top':($(window).height()/ 2) - ($('#login')。height()/ 2) - (($(window).height()/ 100)* 10)
});

$ b $(document).ready(function(){

$('#login-btn')。click(function(){
$('。inner')。stop(true,true).fadeOut({duration:700,queue:false})。slideUp(700);
$('。login-loader')。delay (700).fadeIn(300);
setTimeout(function(){
$('#logon-form')。submit();
},2800);
});

});

< / script>

< / body>
< / html>

auth / logon.php:

 <?php 
/ ** ============================== =======================================

logon.php

该文件将用户登录到主系统中。

========================================== ============================= * /

课程访问权限{

函数authenticate(){

$ user_request = $ _POST;

if(isset($ user_request)){

$ username = $ user_request ['inputEmail'];

$ password = $ user_request ['inputPassword'];

var_dump($ _ POST);

} else {

header(Location:../../login.php);






$ access = new access();
$存取 - >认证();
?>

查看实际中的页面点击此处 原因是PHP使用名称属性。如果您的输入是 name ='test',那么在PHP中它会是 $ _ POST ['test']


I am constructing a advanced login system for one of my new projects, however the problem i am having is in the simplest part. the posted form data.

The data from which is not being transferred between the below pages. I have been going over this for an hour now and I cannot find a problem.

Your guys' help would be appreciated, Thanks.

Code and Notes:

login.php:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Live Home :: Client Login</title>

        <link rel="stylesheet" href="css/core.core.css" type="text/css" />
        <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
        <script src="js/common.js" type="text/javascript"></script>
        <script src="bundles/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    </head>

    <body>

        <header>
          <div class="bar"></div>
            <div class="btm"></div>
        </header>


        <section id="login">
          <div class="drop">
            <div class="top">
                <h2>Live Home</h2>
                <hr class="sec-sep" style="width:100px;" />
            </div>
            <section id="FOH">
                <div class="inner">
                    <form class="form-horizontal" method="post" id="logon-form" action="auth/logon.php">
                        <div class="control-group">
                            <label class="control-label" for="inputEmail">Username / Email : </label>
                            <div class="controls">
                                <input type="text" id="inputEmail" placeholder="Username / Email" />
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="inputPassword">Password : </label>
                            <div class="controls">
                                <input type="password" id="inputPassword" placeholder="Password" />
                            </div>
                        </div>
                        <div class="control-group">
                            <a id="login-btn" class="btn btn-primary btn-mid-login">Sign in</a>
                        </div>
                    </form>
                </div>
                <div class="login-loader"></div>
            </section>
          </div>
        </section>

    <script type="text/javascript">

    $(window).bind('load resize', setPos);

    function setPos(){
        $('#login').css({
            'margin-top':   ($(window).height() / 2) - ($('#login').height() / 2) - (($(window).height() / 100) * 10)
        });
    }

    $(document).ready( function() {

        $('#login-btn').click( function() {
            $('.inner').stop(true, true).fadeOut({ duration: 700, queue: false }).slideUp(700); 
            $('.login-loader').delay(700).fadeIn(300); 
            setTimeout(function() {
                $('#logon-form').submit();  
            },2800);
        });

    });

    </script>

    </body>
</html> 

auth/logon.php:

<?php
    /**=====================================================================

    logon.php

    This file logs users into the main system.

    =======================================================================*/

    class access {

        function authenticate () {

            $user_request = $_POST;

            if(isset($user_request)){

                $username = $user_request['inputEmail'];

                $password = $user_request['inputPassword'];

                var_dump($_POST);

            }else{

                header("Location: ../../login.php");

            }

        }

    }

    $access = new access();
    $access -> authenticate();
?>

To see the pages in action click here.

解决方案

The reason is that PHP uses the name attribute. if your input is name = 'test' that in PHP it would be $_POST['test']

这篇关于$ _POST不传递任何变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆