read file csv fill out a form

0

I need to automate a process, I need to read a csv file (generated by an excel) and be able to automatically dump it into a common php web form.

Is it possible to do it with these tools?

the idea would be, enter a form, and at the time of executing the code, this form read a csv file (or some other format you can create in excel) and send the saved data to an assigned mail by loading automatic.

    
asked by krylogger 27.08.2018 в 19:02
source

1 answer

0

Use this code copied from the phgetcsv definition of the PHP documentation ( link ):

<?php
$row = 1;
if (($handle = fopen("test.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
    }
    fclose($handle);
}
?>
    
answered by 27.08.2018 / 23:01
source