Errr.... sorry guys, I've beaten you to it...
I have found that by defining a variable $count = 0 and then increasing that variable $count = $count + 1; for each result I am able to get a total.
for those who are interested here is the new code:
<?
$filename = "file.txt";
$count = 0;
$handle = fopen ($filename, "r");
$fileread = file("file.txt");
foreach($fileread as $key => $val) {
$data[$key] = explode("\t", $val);
$data[$key] = str_replace("\"","",$data[$key]);
}
$totallines = count($fileread);
for($i = 0; $i < $totallines; $i++)
if ($data[$i][0] != "Ref"){
if (($data[$i][1] == $_POST[Company]) || ($_POST[Company] == "All")) {
if (($data[$i][7] == $_POST[Location]) || ($_POST[Location] == "All")) {
if (($data[$i][4] == $_POST[Type]) || ($_POST[Type] == "All")) {
$Location= stripslashes($data[$i][7]);
$Amount= stripslashes($data[$i][9]);
$count = $count + 1;
echo "
<tr>
<td bgcolor=\"#E3E6EF\" align=\"center\" height=\"20\" valign=\"top\" width=\"130px\"><p>".$data[$i][1]."</p></td>
<td bgcolor=\"#E3E6EF\" align=\"center\" valign=\"top\" width=\"100px\"><p>".$data[$i][4]."</p></td>
<td bgcolor=\"#E3E6EF\" align=\"center\" valign=\"top\" width=\"150px\"><p>$Location</p></td>
<td bgcolor=\"#E3E6EF\" align=\"center\" valign=\"top\" width=\"100px\"><p>$Amount</p></td>
<td bgcolor=\"#E3E6EF\" align=\"center\" valign=\"top\" width=\"75px\"><a href=\"#\" onClick=\"MM_openBrWindow('display_details.php?Ref=".$data[$i][0]."','displaydetails','width=520,height=400,left=100,top=100,scrollbars=yes')\">Click</a></td>
</tr>
";
$Index++;
} } } }
?>
<tr>
<td><? echo "$count"; ?></td>
</tr>