0

File 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;

    }

File 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";?>

It's quite difficult to describe my problem, I have 2 files, 1 file .html and 1 file .php, when I click button "Login", it'll connect mySQL to process and return result, but when I try to click button Login, it's just show a nothing page, not return result. Yesterday, It's OK but now I don't understand what wrong with it?

0 Answers0