Helo all and sorry if this is beat to death, I havent found an answer yet.
I am reading a text file where each line has 3 feilds. I am trying to read that data into an an array but I am having no success. Every example I have seen on the subject uses static data but I dont know what the data is until its been read. If anyone could give me some pointers I would appreciate it.
The data is Id#, Last Name, First and Middle Name
<html><body>
<?php
$data = $_POST['data']; // this is comming from a form but I am still working out the array
$item = $_POST['item'];
$file = "list.txt";
$f = fopen($file, "r");
while ( $line = fgets($f) )
{
list( $id, $lastName, $firstAndMiddle ) = explode( ",", $item );
$Sarray = array(array($id, $lastName, $firstAndMiddle)); //This is where I need help
}
/*
echo "<table border='1' cellpadding='1' cellspacing='1'>";
echo "<tr><th>CWID</th><th>First Name Middle Name</th><th>Last Name</th></tr>";
echo "<tr><td>$Sarray[0][0]</td><td>$Sarray[0][1]</td><td>$Sarray[0][2]</td></tr>";
*/
echo '|'.$Sarray[0][0].'|'.$Sarray[0][1].'|'.$Sarray[0][2].'|<br />';
?>
</body></html>
Thanks in advance
Bryce