2016-03-26 31 views
-3

if (!empty) {} bölümünün ardından ELSE AÇIKLAMASI YAPILIR.Neden bu PHP kodu koşulu çalışmıyorsa?

<form action="first.php" method ="post"> 
<input type="text" name="username" >Username</br> 
<input type="password" name="password" >Password</br> 
<input type="submit" value="Submit"></br> 
</form> 

<?php 
if (isset($_POST['username'])&& isset($_POST['password'])) { 
    if (!empty($user) && !empty($pass)) { 
     $user = $_POST['username']; 
     $pass = $_POST['password']; 

     if ($user ==="habib" && $pass === "1234") { 
      echo $user; 
      echo $pass; 
     } else { 
      echo "wrong password and username"; 
     } 
    } 
} 
?> 
+2

Bu, php kodu değil. –

+1

Sadece html ve 'if else 'ifadesi yok –

+1

Ayrıca bu phpmyadmin' ile ilgisi yok. – arkascha

cevap

2

Sen $_POST['username'] ve $_POST['password'] yerine $user ve $pass daha boş olup olmadığını kontrol etmeniz gerekir.

+0

<şekilde etki = "first.php'de" yöntemi = "post"> \t adı
\t Şifre
\t
habib

+0

bu \t \t} \t} sen upvote ve onu kabul misiniz, şimdi çalışma sayesinde .......... – habib

+0

çalışmıyor ? –