+ 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>
1 ответ
0
// See my code
https://code.sololearn.com/WY2j8eKYFG5v/#js