i have pushed the limit of my newbie knowledge and need help please.
i have to output timesheet data from a flat file (text file), allow the user to change the hours worked and then save the data back to the flat file.
How can this be achieved?
i am assuming the easiest way is to display the output using an html table with a text field containing hours worked so as to allow any changes. i have achieved this using an array. see code below
this is the point where i have come unstuck. how do i get the data in the html table format back into the flat file?
any help much appreciated
daniel
NB i have to use a flat file for this project.
$salrecords = file("./salrecords.txt");
// count the number of orders in the array
$number_of_records = count($salrecords);
if ($number_of_records == 0)
{
echo "<p><strong>No salary records on file."
."Please try again later.</strong></p>";
}
echo "<table border=1>\n";
echo "<tr><th bgcolor = \"#CCCCFF\">First Name</td>
<th bgcolor = \"#CCCCFF\">Last Name</td>
<th bgcolor = \"#CCCCFF\">Hours worked</td>
<th bgcolor = \"#CCCCFF\">Week Number</td>
<tr>";
echo"<form method=post action=\" \">";
for ($i=0; $i<$number_of_records; $i++)
{
//split up each line
$line = explode( ",", $salrecords[$i] );
echo "<tr><td>$line[0]</td>
<td align = right>$line[1]</td>
<td align = right><INPUT TYPE=\"text\" NAME=\"hours\" value=\"$line[2]\"></td>
<td align = right>$line[3]</td>
</tr>";
}
echo "</table>";
echo"</form>";
?>