<?php 
// Include main file
include_once('../libs/main.php');
// Check admin Login
include_once('checkLogin.php');
// Logical section of page

if(isset($_POST['submit'])){

   if(isset($_FILES['import_customer']) && $_FILES['import_customer']['name']!=''){
        $filename=$_FILES['import_customer']['tmp_name'];
        $csvObj = new csvimport("tbl_customer", $filename);
        $collname = w::getTableImportColl()[$csvObj->tablename];
        // if need to add dynamic id here eg. user_client_id
        $post = array_flip($collname);
        $extraField = array_intersect_key($post, $_POST);
        if($extraField && count($extraField)>0){foreach($extraField as $key => $extra){
          $csvObj->extraField[]=$_POST[$key];  
        }}
        // if need some functionality on specific key eg. some field already have comma (,)
      	$csvObj->exceptional=['6']; 
        $csvObj->colname = $collname;
        $csvObj->import(); 
    }

}

// Include Template 
include_once('../libs/routs.php')

?>