當我wan't登記我在我的網站我要創建我得到這個錯誤登記系統
Notice: Undefined index: username in C:\xampp\htdocs\Code\login.php on line 35
Notice: Undefined index: password in C:\xampp\htdocs\Code\login.php on line 40
password doesn't match.
它是如此的行:
<?php
if(isset($_POST['register'])){
if(empty($_POST['rusername']) or empty($_POST['rpassword']) or empty($_POST['crpassword'])){
echo "Fields cannot be empty";
}else{
$do = mysql_query("SELECT * From users WHERE username='".mysql_real_escape_string($_POST['username'])."'");
if(mysql_num_rows($do) == 1){
echo "Users busy.";
}else{
$rusername = mysql_real_escape_string($_POST['rusername']);
$password = mysql_real_escape_string(sha1($_POST['password']));
$rpassword = $_POST['rpassword'];
if($password == $rpassword){
mysql_query("INSET INTO users (username, password) VALUES ('$rusername','$rpassword')");
echo "Account created.";
}else{
echo "password doesn't match.";
}
}
}
}
?>
希望有人能幫助我:)
這是HTML代碼:
<form method="post">
Användarnamn:<input type="text" placeholder="Ditt användarnamn" class="mywidth1" name="rusername"><br />
Lösenord:<input type="password" placeholder="Ditt lösenord" class="mywidth2" name="rpassword"><br />
Verifiera lösenord: <input type="password" placeholder="Skriv lösenordet igen" class="mywidth" name="crpassword"><br />
<input type="submit" class="regbutton" value="" name="register">
</form>
對於寄存器
看看r和c的位置太多或丟失...... – bwoebi
對於特定的編程問題,您無需任何幫助。您需要幫助學習我指導您http://dev.mysql.com/doc/和http://php.net/manual/en/index.php的語言,因爲SO不是個人導師。 – PeeHaa
我不認爲你得到錯誤後曾嘗試通過代碼。您沒有使用與html格式相同的變量名稱。此外,您已將sha1用於一個字段,而不是用於其他字段。 –