I have attached an image file
i want to escape first there rows and import data from sudha----

 if(isset($_POST['submit']))
    {
         $account_type = $_POST['account_type'];
         $fname = $_FILES['sel_file']['name'];
         echo '<center class=green>Uploaded file name is: '.$fname.'</center> ';
         $chk_ext = explode(".",$fname);

         if(strtolower(end($chk_ext)) == "csv")
         {

             $filename = $_FILES['sel_file']['tmp_name'];
             $handle = fopen($filename, "r");

             fgetcsv($handle); //skip the reading of the first line from the csv file


             while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
             {

                    $var = $data[3]; // dd.mm.yy
                    $data[3] = implode("-", array_reverse(explode(".", $var))); // converted -> yyy-mm-dd

                 /********************************PURCHASE***********/
                if($account_type == 1){ 


                    $sql = "INSERT into purchase(party_name,tin,invoice,date,quantity,amount) values
                           ('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."','".$data[4]."','".$data[5]."')";

                 }
                 /********************************SALES***********/

                 if($account_type == 2){ 
                    $sql = "INSERT into sales(party_name,tin,invoice,date,quantity,amount) values
                           ('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."','".$data[4]."','".$data[5]."')";


                 }
                  /********************************RECEIPTS***********/

                 if($account_type == 3){ 
                    $sql = "INSERT into receipts(party_name,receipt_no,date,amount) values
                           ('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."')";


                 }

                  /********************************PAYMENTS***********/

                 if($account_type == 4){ 
                    $sql = "INSERT into payments(party_name,receipt_no,date,amount) values
                           ('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."')";


                 }



                        mysqli_query($con,$sql) or die(mysqli_error());
             }//while

                 fclose($handle);
                 echo "<center class=green>Successfully Imported</center><br/>";


         }//if->csv
            else
            {
                echo "Invalid File";
            }   
    }//submit

    ?>


   <form action='<?php echo $_SERVER["PHP_SELF"];?>' method='post' enctype="multipart/form-data" class="elegant-aero">
    <h1>CSV File Import
        <span>Please Import Csv File</span>
    </h1>
    <label>
       <span>Select Account Type:</span>
       <select name="account_type" required>
       <option value="">Select</option>
       <option value="1">Purchase</option>
       <option value="2">Sales</option>
       <option value="3">Receipts</option>
       <option value="4">Payments</option>
       </select>
    </label>

    <label>
        <span>Browse File :</span>
        <input id="name" type="file" name="sel_file" placeholder="Your Full Name" />
    </label>

     <label>
        <span>&nbsp;</span> 
        <input type="submit" name="submit" class="button" value="Submit" /> 
    </label>    
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.