Filling a table with details from a file?
Hi Everyone,
I'm using dreamweaver CS5, i have a form and in that form is a table of 2 columns and 32 rows
I want to fill the left hand column using the details from a file (in this case a list of students names) BUT with a twist.....i want it to fill the left hand column with the student names each time the page loads, for example if that particular file is changed or updated i want the names in that column to change with it.
Is there any way to do this? I'd prefer a method that works in php/html, no asp etc
Cheers
EDIT:
Found this online, no idea how it works or if it would be suitable for my needs? can someone explain what it is doing on each line and wether it would work (or be adapted to work) for my requirements?
Code:
<?php
$file = file("data.txt");
print "<table>
<tr><td>Field 1</td><td>Field 2</td><td>Field 3</td></tr>";
foreach($file as $line){
$line = trim($line);
$split = split("\t",$line);
print "<tr><td>$split[0]</td><td>$split[1]</td><td>$split[2]</td></tr>";
}
print "</table>";
?>