Login script is not working

Hello all ,

I have tried many alternatives to this error but none of them works (all of them are commented) .Login form [login.php] is directed to scripts login.php [scripts/login.php] . In scripts/login.php file , the admin if block is working but login of providers from database is not working .

here is login.php

<?php

include_once "./msg/login.php";
?>
<!doctype html>
<html>
<head>
  <link rel="shortcut icon" type="image/png" href="imgs/favicon.png">


      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>URBAN AMENITIES</title>
      <link rel="stylesheet" href="cssmain/bootstrap.min.css">
      <link rel="stylesheet" href="cssmain/style.css">
      <link rel="stylesheet" href="cssmain/fontawesome.min.css">
      <link href="https://fonts.googleapis.com/css?family=Open+Sans|Roboto" rel="stylesheet">
   </head>
   <body>
      <div id="header" class="header">
         <nav class="navbar navbar-expand-lg navbar-light text-capitalize">
            <div class="container">
               <a class="navbar-brand" href="#"><img src="imgs/logo.png" alt="#" /></a>
               <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#show-menu" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
               <span class="navbar-toggler-icon"></span>
               </button>
               <div class="collapse navbar-collapse" id="show-menu">
                  <ul class="navbar-nav ml-auto">
                     <li class="nav-item">
                         <a class="nav-link" href="index.html">Home</a>
                     </li>
                    
                     <li class="nav-item">
                        <a class="nav-link" href="services.php">Services</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link active" href="how.php">How it Works</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link active" href="index.php">Instant Service</a>
                     </li>
                     
                    <li class="nav-item">
                        <a class="nav-link" href="review.php">What Clients Say</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link" href="contact.php">Contact</a>
                     </li>
                    <li class="nav-item">
                        <a class="nav-link" href="register.php">Register</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link" href="login.php">Login</a>
                     </li>
                     <li class="nav-item">
                        <a class="nav-link active" href="feed.php">Feedback form</a>
                     </li>
                  </ul>
               </div>
            </div>
         </nav>
      </div>

<div class="container" style="margin-top: 50px; width: 450px;">
    <div class="card">
       
        <div class="card-body">
            <div class="card-title">
                <h3 class="text-center">Login for Service Providers</h3>
            </div>
            <hr>
            <div class="contact-form">
            <form action="scripts/login.php" method="post">
                    <label for=""><strong>Contact No : </strong></label>
                    <input id="contact" name="contact" class="form-control" placeholder="Enter Your Contact No." minlength="10" maxlength="10" required>
                    <label for=""><strong>Password :</strong></label>
                    <input id="password" name="password" type="password" class="form-control" placeholder="Enter Password." minlength="6" required><br>
                    <input type="submit" name="login" value="Login" class="btn btn-block btn-primary">
                </div>
            </form>

        </div>
    </div>
</div>

<footer >
         <div class="container">
            <div class="row">
               <div class="col-lg-3 col-md-6 col-12">
                  <div class="footer_blog_section">
                     <img src="imgs/logo.png" alt="#" /><br><br>
                     <p style="margin-top: 3px; font-size: 15px">URBAN AMENITIES platform helps customers book reliable home services like beauty services, massage therapy, cleaning, plumbing, carpentry, appliance repair, painting etc. We offer home maintenance, repair services, home beauty and wellness services. Thereby empowering service providers to showcase their work .</p>
                  </div>
               </div>
               <div class="col-lg-2 col-md-6 col-12">
                  <div class="item">
                     <h4 class="text-uppercase">Navigation</h4>
                     <ul>
                        <li><a href="#">Home</a></li>
                        <li><a href="#">About</a></li>
                        <li><a href="#">Location</a></li>
                        <li><a href="#">Service</a></li>
                        <li><a href="#">Features</a></li>
                     </ul>
                  </div>
               </div>
               <div class="col-lg-4 col-md-6 col-12">
                  <div class="item">
                     <h4 class="text-uppercase">Contact Info</h4>
                     <p><strong>Corporate Office Address:</strong></p>
                     <p><img src="imgs/phone_icon.png" alt="#" />+91 </p>
                     <p><strong>Customer Service:</strong></p>
                     <p><img src="imgs/location.png" alt="#" />  .</p>
                  </div>
               </div>
               <div class="col-lg-3 col-md-6 col-12">
                     <div class="item">
                     <h4 class="text-uppercase">Follow </h4>
                     <ul>
                        <li><img src="imgs/icon1.jpg"><a href="http://localhost/homeservices/index.html"> Website</a></li>
                        <li><img src="imgs/icon2.jpg"><a href="sarassk21@gmail.com"> Gmail</a></li>
                        <li><img src="imgs/icon3.jpg"><a href="/"> Instagrm</a></li>
                        <li><img src="imgs/icon4.jpg"><a href="/"> Facebook</a></li>
                        <li><img src="imgs/icon5.jpg"><a href="www.youtube.in"> Youtube</a></li>
                        <li><img src="imgs/icon6.jpg"><a href=""> LinkedIn</a></li>
                     </ul>
                  </div>

               </div>


            </div>

         </div>
         <div class="copyright text-center">
            <p> URBAN AMENTIES &copy; <?= date("Y") ?>All Rights Reserved.</p>
         </div>
      </footer>

here is scripts/login.php

<?php

require_once 'session.php';
require_once 'helpers.php';

if (isset($_POST['login'])) {
    $contact = test_input($_POST["contact"]);
    $pass =test_input($_POST["password"]);
    if ($contact == "" && $pass == "admin123") {
        $s = new stdClass();
        $s->name = "admin";
        $_SESSION['user'] = $s;
        header('Location: ../admin.php');
        exit();
    } else {
            $servername ="localhost";
            $username ="root";
            
            $dbname="services";
            
            try {
                $conn = new PDO('mysql:host=localhost;dbname=services; charset=utf8','root','sarasaeed');
                $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $sql = "SELECT * FROM providers WHERE contact = '$contact' AND password = '$pass'";
                $statement = $conn->prepare($sql);  
                $statement->execute();  
                $providers = $statement->fetchAll();
                  // var_export($providers);
                
                /*if(isset($providers)){
                    header('Location: /msg/login.php?msg=success');
                    header('Location: /homeservices/provider.php'); 
                    
                    exit();

                }
                else{
                    header('Location: scripts/login.php?msg=failed');
                    exit();

                }*/

                foreach($providers as $provide=>$values) { 

                    if(($provide['contact'] =="$contact") &&  ($provide['password'] == "$pass")) { 
                        header('Location: ../login.php?msg=success');
                        header('Location: ../provider.php'); 
                        $_SESSION['user']=$provide;
                        exit();
                    }else { 
                        header('Location: ../login.php?msg=failed');
                        exit();
                    }
                }
            }
            catch(PDOException $e) {
                echo "Connection failed: " . $e->getMessage();
            }
                $conn = null;
            }
        }
?>