我正在创建一个验证页面,以便在用户注册时对其进行验证


i am creating a verification page to validate users when they register

i试图在允许用户输入之前验证数据中的用户名和密码。这是我的密码。结果是它跳过并转到else语句

if(!empty($_POST['username']) && !empty($_POST['code']))
{
    $checkcode = mysql_query("SELECT * FROM members WHERE Username = '".$username."' AND Code  = '".$code."'");
    if(mysql_num_rows($checkcode) == 1)
    // $row = mysql_fetch_array($checkcode);
    {
        header("Location: home.php");
    }
    else
    {
        echo "<h1>Error</h1>";
        echo "<p>Sorry, your account could not be found. Please <a href='"index.php'">click here to try again</a>.</p>";
    }
}
  1. 修复您的格式:)
  2. 我看不出您将$_POST['username']分配给$username变量,与$code相同