php - How can I process this fail? -
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 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 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: id account null"); return false; } else if(isnan(c)){ alert("error: id must number"); return false; } return true; }
file processlogin.php:
<?php $user = $_post["idcuaban"]; $pass = $_post["passcuaban"]; //connect server $con = mysql_connect("localhost", "root", ""); if(!$con){ die("cound not connect"); } //select database mysql_select_db("db_atmvisual"); $query = mysql_query("select * tb_account account_id='$user' , 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 describe problem, have 2 files, 1 file .html , 1 file .php, when click button "login", it'll connect mysql process , return result, when try click button login, it's show nothing page, not return result. yesterday, it's ok don't understand wrong it?
Comments
Post a Comment