> |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
> |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
> So for example, lets say I wanted to make another html form
> that has a form
> field for List team by: and and select either "home" or "away" ... by
> selecting "home", the browser would print out the following:
> so now I need to figure out how to get PHP to do the following:
> #1 look at each line in the text file and treat it individually
> #2 select the data after the 4th | from each line
> #3 print it back to the browser
$fd = fopen ("/tmp/inputfile.txt", "r"); // Opens file for reading
while (!feof ($fd)) // Start of loop.
$buffer = fgets($fd, 4096); // Reads one line of maximum 4096 bytes
$arr = explode("|", $buffer); // Divides each row into separate elements
in an array.
echo $arr; // Prints the 5th element of each row.
// The first element ($arr) is actually "" (an empty string) since each
line starts with |.
Hopefully this will get you in the right direction.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php