login page with php code not working properly

rsbypi4

New member
I want to login in my site with my code below,

PHP:
<?php
    session_start();
    include('vendor/inc/config.php');//get configuration file
    if(isset($_POST['send']))
    {
      $u_email=$_POST['u_email'];
      $u_phone=($_POST['u_phone']);
      $stmt=$mysqli->prepare("SELECT u_email, u_phone, u_id FROM tms_user WHERE u_email=? and u_phone=? ");//sql to log in user
      $stmt->bind_param('ss',$u_email,$u_phone);//bind fetched parameters
      $stmt->execute();//execute bind
      $stmt -> bind_result($u_email,$u_phone,$u_id);//bind result
      $rs=$stmt->fetch();
      $_SESSION['u_id']=$u_id;//assaign session to admin id
    
      if($rs)
      { //if its sucessfull
        //header("location:admin-dashboard.php");
        $succ = "complete";

      }
      else
      {
      $error = "Access Denied Please Check Your Credentials";
      }
  }
?>


I want to try to login with email and phone number, but it's not working. What is the problem in my code. Can someone check what is the problem in my code?
If I run my code they no showing any problem, But I try to put the message
PHP:
 $succ = "complete";
to show if my code is working properly, But the message "complete" not show. Please someone can tell me what is the problem in my code.
 
Where are you displaying the "Complete" message? From what I can see, all you have is stating that $succ means "Complete" but you are not actually displaying it anywhere with an echo. Likewise for the $error message

Without the echo, your messages will not display.
 
Where are you displaying the "Complete" message? From what I can see, all you have is stating that $succ means "Complete" but you are not actually displaying it anywhere with an echo. Likewise for the $error message

Without the echo, your messages will not display.
Good day Moorcam, you are correct I forgot to declare
PHP:
<script src="vendor/js/swal.js"></script>
thank you for your reply.
 
Back
Top