我用 PHP MySQL 创建了一个登录表单,我需要允许用户使用用户名或电话号码登录。
我有这个代码: -
<form method="post" action="">
User name:<input type="text" name="uname" />
PWD:<input type="password" name="pwd" />
<input type="submit" name="sub" />
PHP代码:
<?php
include "config.php";
$uname = $_POST['uname'];
$pwd = $_POST['pwd'];
$query=mysql_query("select * from users where userId='$uname' and pwd ='$pwd' ");
if($query){
echo "login success":
}else
echo "login fail";
?>