<?php
session_start();
if(isset($_SESSION['User'])){
include("db.php");
?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <title>Driver Logbook</title>
    <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/fonts/font-awesome.min.css">
    <link rel="stylesheet" href="assets/css/Login-Form-Clean.css">
    <link rel="stylesheet" href="assets/css/Login-Form-Dark.css">
    <link rel="stylesheet" href="assets/css/Registration-Form-with-Photo.css">
    <link rel="stylesheet" href="assets/css/styles.css">
</head>

<body style="background-image: url(&quot;assets/img/star-sky.jpg&quot;);">
  <form action="start-trip.php" method="POST">
  <div class="form-container" style="padding-top:60px">
    <div class="card" style=" max-width:900px; width:80%; margin:auto; border-radius:20px;" >
  <div class="card-header">
    <form action="start-trip.php" method="POST">
    <?php $result = mysqli_query($conn, "SELECT * FROM cars");
    $name = mysqli_query($conn, "SELECT username FROM users WHERE username='$_POST[username]'");
  $row = mysqli_fetch_array($name)?>
    <h5 class="mb-0" style="float:left;">Welcome <?php echo $row['username'];?> </h5>

  </div><br>
        <div class="card-body" >
          <div class="input-group" style="margin:0 auto; margin-left:50px;">

            <?php
            while($get = mysqli_fetch_array($result)){ ?>
              <div style="max-width:132px; width:100%;height:170px;margin-top:20px;margin-right:20px;background-color:rgb(213,200,200);">
            <i class="fa fa-car" style="font-size:60px;margin-top:20px;margin-left:40px;color:#fff;"></i>
            <h1 style="font-size:20px;text-align:center;"><?php echo $get['car']?></h1>
            <form action="start-trip.php" method="POST">
            <input type="hidden"  value="<?php echo $get['car']?>" name="car">
<input type="hidden" value="<?php echo $row['username'];?>" name="username">
            <input type="submit" value="Record Journey" style="background: #f4476b;
            border: none;
            border-radius: 4px;
            padding: 7px;
            box-shadow: none;
wi
            text-shadow: none;
            outline: none !important;">

          </div>
          </form>
          <?php }?>
        </div>

        </div></form><br>
        <form action="logout.php" method="POST">
            <input type="submit" name="logout" value="Logout" class="btn btn-warning btn-block mb-3" style="width:40%; margin:0 auto">
        </form>

    </div>
  </div>
</div>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/bootstrap/js/bootstrap.min.js"></script>


</body>

</html>
<?php }else{
  header("Location: index.php");
}?>
