I got the script working. Had a few problems determining the diff between "=" and "==" (and i still am not sure that I know when to use each). However, the following script does everything I want.
I can now read from a list, print out various lines based on a match variable
<center>
<table width=100 border=00 cellpadding=00 cellspacing=00>
<tr> <td colspan=01 align=center valign=top bgcolor="#dddddd"><img src="../grpimg/cleardot.gif" height=001 width=001"></td>
<td colspan=01 align=center valign=top bgcolor="#dddddd"><img src="../grpimg/cleardot.gif" height=001 width=094"></td>
<td colspan=01 align=center valign=top bgcolor="#dddddd"><img src="../grpimg/cleardot.gif" height=001 width=005"></td>
<tr> <td colspan=01 align=center valign=top bgcolor="#dddddd"><img src="../grpimg/cleardot.gif" height=001 width=001"></td>
<td colspan=01 align=right valign=top bgcolor="#abcdef">
<! ------------------------------------------------------->
<?php
$file = file("../grpmenu/sample.txt"); // the file to be read
$line_count = 0; // the line count of the file to being read
$line_contents = ""; // contents of the line being analysed
$display_count = 0; // the count for the lines displayed in the conditional
$display_anything = 0; // Toggle this to 1 (one) once something is shown in the meu
$line_print = ""; // line that is printed
$array[0] = ""; // set array[0] to null so that conditional will work
// term to match
if ( isset($l) ) {
$match = $l; // this sets the match variable to the value sent via URL encoding
echo "<font size=-1>" . strtoupper($match) . "</font>";
while ($display_count < 5) { // note: i want to change the conditional to be able to detect EOF
// a statement like: while (!=EOF) { do stuff };
$line_contents = $file[$line_count];
$array = explode(";",$line_contents);
$array[0] = chop($array[0]); //removes trailing whitespace
$array[1] = chop($array[1]);
$array[2] = chop($array[2]);
$line_print = $array[1];
/*
------------------------
The following lines determin what is printed. If there is a
match, then a parsed section of the line is printed.
If the entire list is read and there are no matches, then
you get an error msg saying that there are no selections.
If the list is read and there are some selections, they
are read until the end of the file.
note: end of file is determined by a string in the file
that is tagged as end.
------------------------
*/
if ( (strcasecmp($array[0],"$match") == 0) ) {
echo "<br>" . $line_print;
$display_count++;
$display_anything = 1;
}
if ( (strcasecmp($array[0],"end") == 0) && ($display_count < 1) ) {
$display_count = 6;
echo "<br> no selections:";
}
if ((strcasecmp($array[0],"end") == 0)) {
$display_count = 6;
}
$line_count++;
unset ($array);
} //end while
} else {
echo "<font size=-1>OPTIONS</font>";
echo "<br> none:";
} //end if-else
echo "<br>";
?>
<!-- ----------------------------------------------------->
<! Contents of sample.txt >
climb ; one -; two
rant ; second -;asdf
climb ; 7 -; 8
climb ; c -; n
vitae ; e -; p
climb ; 3 -; 4
vitae ; g -; r
vitae ; i -; t
vitae ; k -; v
rant ; asdf -; asdf
climb ; a -; l
rant ; asdf -; asdf
vitae ; what -; two
vitae ; winding -; two
end ; end ; end
<----------------------------------------------------- -->
</td>
<td colspan=01 align=center valign=top bgcolor="#abcdef"><img src="../grpimg/cleardot.gif" height=001 width=005"></td>
<tr> <td colspan=01 align=center valign=top bgcolor="#dddddd"><img src="../grpimg/cleardot.gif" height=009 width=001"></td>
<td colspan=01 align=center valign=top bgcolor="#abcdef"><img src="../grpimg/cleardot.gif" height=009 width=094"></td>
<td colspan=01 align=center valign=top bgcolor="#abcdef"><img src="../grpimg/cleardot.gif" height=009 width=005"></td>
<tr> <td colspan=03 align=center valign=top bgcolor="#dddddd"><img src="../grpimg/cleardot.gif" height=001 width=100"></td>
</table>
</center>