<?php
if(isset($_POST["submit_file"]))
{
 $file = $_FILES["file"]["tmp_name"];
 $file_open = fopen($file,"r");
 while(($csv = fgetcsv($file_open, 1000, ",")) !== false)
 {
  $date = $csv[0];
  $name= $csv[1];
  $phone = $csv[2];
  $email = $csv[3];
  $type = $csv[4];
  $source = $csv[5];
  $micro = $csv[6];
  $note = $csv[7];

  $db=mysqli_connect("localhost","root","","real_estate");
  // $sql="INSERT INTO import (Date,Name,Contact_No,Email,Lead_Type,Lead_Source,Lead_Micro_Source,Note) VALUES ('$date','$name','$phone','$email','$type','$source','$micro','$note')";
  $sql="INSERT INTO new_lead (Date,Name,Contact_No,Email,Lead_Status,Lead_Source,Lead_Micro_Source,Note) VALUES ('$date','$name','$phone','$email','$type','$source','$micro','$note')";
  if(mysqli_query($db,$sql)){
    echo "Success";
  }

 }
 header('location:assign_lead.php');
}
?>