<!DOCTYPE html>
<html lang="en">
  <?php include "head.php";
  include "dbconfig.php";
  ?>
  <style>.bgColor {
width: 440px;
height:100px;
background-color: #F9D735;
}
.bgColor label{
font-weight: bold;
color: #A0A0A0;
}
#targetLayer{
float:left;
width:100px;
height:100px;
text-align:center;
line-height:100px;
font-weight: bold;
color: #C0C0C0;
background-color: #F0E8E0;
overflow:auto;
}
#uploadFormLayer{
float:right;
padding: 10px;
}
.btnSubmit {
background-color: #3FA849;
padding:4px;
border: #3FA849 1px solid;
color: #FFFFFF;
}
.inputFile {
padding: 3px;
background-color: #FFFFFF;
}
</style>  

   <body>

      

      <div class="container-fluid">

         <!-- Content Section -->
         
     
      <!-- To Add New Record -->
      <div class="panel col-md-6" style="background-color: #e9e9e9;box-shadow: 5px 5px 5px;">
                    
                     <div class="panel-body">
                    
                     <form method="post" id="full_form" action="ajax/create_car.php" enctype="multipart/form-data">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                           <h2>Car Details</h2>
                           <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                             <div class="form-group">
                                 <label for="first_name">Driver Name</label>
                                  <select name="driver_id" style="width:70%;background-color:#053DD4; color:#ffffff;" id="vehicle" class="form-control">
                               <?php
                 
                  $skip_sql="SELECT id,first_name,phone from employees order by first_name ASC";
				  
                  $t_result=mysqli_query($con,$skip_sql);
                  while($vehicle=mysqli_fetch_assoc($t_result))
                  {
                  ?>
                  
  <option style="padding:10px; background-color:#2977C9; color:#F9F0F1; cursor:pointer;" value="<?php echo $vehicle['id']; ?>">
     <?php echo $vehicle['first_name']." ". $vehicle['phone'];?>
    </option>
            <?php
            
            }
            ?>
                                </select>
                              </div>
                              <div class="form-group">
                                 <label for="phone">Car Make</label>
                                 <input type="text" id="phone" name="make" placeholder="E Class Mercedes" class="form-control radius" />
                              </div>
                              <div class="form-group">
                                 <label for="mot_date">MOT Date</label>
                                 <input type="date" id="mot_date" name="mot_date" placeholder="MOT Date" class="form-control radius" />
                              </div>
                           </div>
                           <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                              <div class="form-group">
                                 <label for="address">Color</label>
                                 <input type="text" id="address" name="color" placeholder="Black" class="form-control radius" />
                              </div>
                              <div class="form-group">
                                 <label for="post_code">Passengers</label>
                                 <input type="text" id="post_code" name="passengers" value="4" class="form-control radius" />
                              </div>

                              <div class="form-group">
                                 <label for="post_code">Car Reg</label>
                                 <input type="text" id="post_code" name="reg" value="4" class="form-control radius" />
                              </div>
                  
               <div class="form-group pull-right">
                  <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                  <input type="submit" onClick="addcar();" class="btn btn-primary" value="Add Record" />
               </div> 
               
               </form>
            </div>
       
      </div>
      </div>
    </div>
    </div>
      <script type="text/javascript">
function addcar() {
      var form=$('#new_car_form');
      var url11 = 'ajax/create_car.php?'+new Date().getTime();
                $.ajax({
                    type: "POST",
                    url: url11,
              data: form.serialize(),
                    success: function(data) {
                     alert("Car Added");
		   
                }
            });
}
</script>
   </body>
</html>
