Después de hacer clic en el botón de inicio de sesión, permanece en la misma página y no da ningún resultado, por ejemplo: si introduzco un ID de usuario o una contraseña incorrectos, debería hacer eco de algo, pero no hace eco de nada y permanece igual, el código para INICIAR SESIÓN. El ARCHIVO PHP es:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>title of the document</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <form action"signin.php" method="POST"> <input type="text" name="uid" placeholder="Username"><br> <input type="password" name="password" placeholder="PAssword"><br> <button type="submit">SIGN IN</button><br> </form> <br><br><br><br> <form action="signup1.php" method="POST"> <input type="text" name="firstname" placeholder="Firstname"><br> <input type="text" name="lastname" placeholder="Lastname"><br> <input type="text" name="uid" placeholder="Username"><br> <input type="password" name="password" placeholder="PAssword"><br> <button type="submit">SIGN UP</button><br> </form> </body> </html>el archivo signin.php es:
<?php include 'dbh1.php'; $userid=$_POST['uid']; $pwd=$_POST['password']; $sql="select * from userlogin where uid='$userid' AND password='$pwd'"; $result = $conn->query($sql); if (!$row = $result->fetch_assoc()) { echo "YOU ARE NOT LOGGED IN INCORRECT CREDENTIALS!!"; } else { echo "SUCCESFULLY LOGGED IN!!"; }He probado esto y está funcionando. Aquí aprender declaraciones preparadas
<form action"signin.php" method="POST"> <input type="text" name="uid" placeholder="Username"><br> <input type="password" name="password" placeholder="PAssword"><br> <input type="submit" value="Sign In" /> </form> <?php include 'database.php'; $userid=$_POST['uid']; $pwd=$_POST['password']; $stmt = $conn->prepare("select * from userlogin where uid=? AND password=?"); $stmt->bind_param("ss",$userid, $pwd); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $stmt->close();Con declaraciones preparadas has logrado muchas cosas. Solo trata de comprobarlo.