View Single Post
  #3 (permalink)  
Old 28-01-2008, 14:02
DavidAllen's Avatar
DavidAllen DavidAllen is offline
Premium Member
 
Join Date: Jan 2007
Location: Amersham
Posts: 330
Send a message via MSN to DavidAllen Send a message via Skype™ to DavidAllen
Default

PHP Code:
//display the file in a table
echo '<table>';
//first read whole file into an array
$LinesArray file('path_to_file'.'/textfile.txt');
//loop through each line
for ($i=0;$i<count($LinesArray);$i++) {
//split the line into fields
$FieldsArray=explode(' ',$LinesArray[$i])
echo 
'<tr>';
for (
$j=0;$j<count($FieldsArray);$j++) {
echo 
'<td>'.rtrim($FieldsArray[$j].'</td>';
}
echo 
'</tr>';
}
echo 
'</table>'
That displays the file in a table

To edit you would need to wrap the whole lot in a form and use input fields
To delete you would need to use a checkbox or something at the end of each line

The processing of the form is a bit more complicated - but I hope the above helps for a start

PS - In the long run I think you would probably be better keeping the data in a database as that will give you much better flexibility (and security).

Regards
__________________
David Allen - www.serina.co.uk
Reply With Quote