Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
php mysql programming issue for login page

After clicking on the login button it remains on the same page and it does not give nay output for example:if i put in a wrong userid or password it should echo something but it does not echo anything and stays the same the code for LOGIN.PHP FILE is:

<!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>

the signin.php file is:

<?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!!";
    }
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I have tried this and it is working. Here learn prepared statements

<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();

With prepared statements you have achieved a lot of things. Just try to check it.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda