PHP fputs function

hi all, i have a simple php program which writes some data retrieved from a form to a text document. My problem is that when i run the script the data overwrites the previous data. i was wondering how to get around this. any help would be appreciated. The script looks like this

$details = “details.txt”;
$det = file($details);
$det[0] = $_POST[“first”];
$one = $det[0];
$det[1] = $_POST[“second”];
$two = $det[1];
$det[2] = $_POST[“age”];
$three = $det[2];

$opened = fopen($details , “w”);
fputs($opened , “$one”);
fputs($opened , “$two”);
fputs($opened , “$three”);
fclose($opened);