I want to display a .csv file neatly in a table using php. Some content of the file are empty field.
Here is my first approach, got an error but displaying the datas in one row. Supposedly they should display in their respectively fields.
Should be like this:
<table border = "1">
<tr>
<th>NAME</th>
<th>Email</th>
<th>Address</th>
<th>Payment</th>
<th>Datepaid</th>
</tr>
<?php
$data = file("data/payment.csv");
foreach ($data as $line){
$lineofarray = explode("\t", $line);
list($name, $email, $address, $payment, $datepaid) = $lineofarray;//error here
?>
<tr>
<td>
<?= $name?>
</td>
<td>
<?= $email?>
</td>
<td>
<?= $address?>
</td>
<td>
<?= $payment?>
</td>
<td>
<?= $datepaid?>
</td>
</tr>
<? }?>
</table>
My code now had an error on the part of list. And displaying the datas in one field. Hope you can help me. Thanks

