+ 2

trying to print an indexed array in html format from a csv file

here is my code: <!doctype html> <html> <head>     <title> Print Student Details from File to HTML Table     </title> </head> <body> <h1>Print the student Details to HTML table</h1> <?php         $fileName = "students.csv";     $csvFile = file($fileName);     var_dump($csvFile);     foreach( $csvFile as $line){         $data[] = str_getcsv($line);         print_r($data);     }            echo '<table border="1">';        echo '<tr><th>Student Name</th><th>Age</th><th>Sex</th></tr>';                     foreach( $line as $cell ) {              echo "<tr>";             foreach($row as $cell){                 echo "<td>" . $row . "</td>";             }             echo "</tr>";         }     echo "</table>"; ?> </body> </html>

19th Nov 2019, 11:04 PM
Justin Evans
Justin Evans - avatar
1 Respuesta
27th Nov 2019, 1:17 PM
Jônatas Araripe
Jônatas Araripe - avatar