我该如何处理这个失败?

时间:2016-04-25 06:57:35

标签: php html mysql database

文件html:

<div id="background">
    <div class="form-group">
        <label for="usr" style="position:fixed;margin-top:180px;margin-left:900px;"><u>Account ID</u>:</label>
        <form action="processlogin.php" method="post" onSubmit="return process_Login()">
        <input type="text" placeholder="Enter your ID in here" class="form-control" id="usr" name="idcuaban" style="position:absolute;width:350px;margin-top:205px;margin-left:900px;">          
    </div>
    <div class="form-group">
        <label for="pwd" style="position:fixed;margin-top:230px;margin-left:900px;"><u>PIN</u>:</label>
        <input type="password" placeholder="Enter your PIN in here" class="form-control" id="pwd" name="passcuaban" style="position:absolute;width:350px;margin-top:255px;margin-left:900px;">
        <button type="submit" class="btn btn-default" style="font-weight:bold;font-family:Tahoma, Geneva, sans-serif;position:fixed;margin-left:1040px;margin-top:310px;width:100px;">Login</button>
        <button type="submit" class="btn btn-default" style="font-weight:bold;font-family:Tahoma, Geneva, sans-serif;position:absolute;margin-left:1150px;margin-top:310px;width:100px;">Sign Up</button>
         </form>  
     </div>
</div>

function process_Login():

function process_Login(){
        var c = document.getElementById("usr").value;
        var d = document.getElementById("pwd").value;
        if(c.length==0){
            alert("ERROR: Your ID account is NULL");
            return false;
        }
        else if(isNaN(c)){
            alert("ERROR: Your ID must be number");
            return false;
        }
        return true;

    }

文件processlogin.php:

<?php
$user = $_POST["idcuaban"];
$pass = $_POST["passcuaban"];
//connect to server
$con = mysql_connect("localhost", "root", "");
if(!$con){
    die("cound not connect");
}
//select database
mysql_select_db("db_atmvisual");
$query = mysql_query("SELECT * FROM tb_account WHERE account_id='$user' AND account_pin='$pass'");
$row = mysql_num_rows($query);
if($row!=0){
    echo "login sucess";
}
else
    //header('Location:http://loginfail.html');
    echo "Login fail";?>

描述我的问题非常困难,我有2个文件,1个文件.html和1个文件.php,当我点击按钮“登录”时,它会将mySQL连接到进程并返回结果,但是当我尝试点击按钮登录,它只显示一个页面,不返回结果。昨天,没关系,但现在我不明白它有什么问题?

0 个答案:

没有答案