<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
if(isset($_POST["submit"]))
{
    
header( 'Content-Type: text/html; charset=utf-8' );
      $conn=mysqli_connect("localhost","kamavvve_admin","admin@123","kamavvve_veterinary");
      mysqli_set_charset('utf8');
      
          if(!$conn){
          die('Could not Connect My Sql:' .mysqli_error());
		  }
          $file = $_FILES['file']['tmp_name'];
       
          $handle = fopen($file, "r");
          $c = 0;
          while(($filesop = fgetcsv($handle, 1000, ",")) !== false)
                    {
         echo $question = $filesop[0];
         echo $answare = $filesop[1];
          $sql = "INSERT INTO `test`(`question`, `answare`) VALUES  ('$question','$answare')";
          $stmt = mysqli_prepare($conn,$sql);
          mysqli_stmt_execute($stmt);

         $c = $c + 1;
           }
           fclose($handle);
           

            if($sql){
               echo "sucess";
             } 
		 else
		 {
            echo "Sorry! Unable to impo.";
          }

}
?>
<!DOCTYPE html>
<html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<body>
<form enctype="multipart/form-data" method="post" role="form">
    <div class="form-group">
        <label for="exampleInputFile">File Upload</label>
       
        <input type="file" name="file" id="file" size="150">
        <p class="help-block">Only Excel/CSV File Import.</p>
    </div>
    <button type="submit" class="btn btn-default" name="submit" value="submit">Upload</button>
</form>
</body>
</html>