dongyou2635 2013-01-08 17:14
浏览 8
已采纳

$ _POST没有传递任何变量

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.

  • 写回答

3条回答 默认 最新

  • doulu4534 2013-01-08 17:18
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP