Thanks for the help! I ended up doing it a little different but I used the list and each thing you put in your example, verry helpful.
What I did is
Summary of this is. Receive values from a form. Load current file in array. (each line has 4 sections seperated by "|")
Then took eack line looking at the first section to see if it was the same as the name, if it was then copy the other section over top of the current sections. Implode array to a string then write to tmp file. (replace old data with new but keep other info.)
Once done I copied tmp file over top of current file. Then erased tmp file.
<?php
GLOBAL $NAME;
GLOBAL $PASSWORD;
GLOBAL $WHEN;
GLOBAL $WHERE;
GLOBAL $WHAT;
if ($PASSWORD == "ptl"){
//break each line into an array
$file = file("bic.txt");
$newfile = fopen("test.txt",'w+');
$i = 0;
//copy the first element into this array and increment array pointer by one.
while (list(,$i) = each($file))
{ $parts = explode("|",$i);
if ($parts[0] == $NAME)
{$parts[1] = $WHEN;
$parts[2] = $WHERE;
$parts[3] = $WHAT;}
$parts = implode("|",$parts);
fwrite($newfile,$parts);
}
fclose($newfile);
copy("test.txt","bic.txt");
$EraseAll = fopen("test.txt",'w');
fwrite($EraseAll,"");
fclose($EraseAll);}
?>