I'm not sure why you don't just use a database...
it would be much easier...
$file = file('DB.txt');
foreach ($file as $line=>$row) {
$file[$line] = $row;
$file[$id] = "$first_name|$last_name|$address|$city|$state|$zip|$home_phone|$work_phone|$wireless_phone|$email|$dob|$notes|";
}
$fp = fopen('DB.txt','w');
fwrite($fp,implode("\n",$file));
fclose($fp);
I'm not sure why that is being done.
I believe you can take out the foreach...
$file = file('DB.txt');
$file[$id] = "$first_name|$last_name|$address|$city|$state|$zip|$home_phone|$work_phone|$wireless_phone|$email|$dob|$notes|";
$fp = fopen('DB.txt','w');
fwrite($fp,implode("\n",$file));
fclose($fp);
also I'm not sure what's up with imploding using \n yet earlier on replacing all the \n with <br>