Try something like this:
<?php
$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$filename = 'path/to/file.txt';
$somecontent = "$name, $address, $phone\n";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
print "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($handle, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
}
print "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
print "The file $filename is not writable";
}
?>
Then to read the file use this:
$filename = "path/to/file.txt";
function file_get_contents($filename) {
$fd = fopen("$filename", "rb");
$content = fread($fd, filesize($filename));
fclose($fd);
return $content;
}
Or I also believe that frontpage can do that pretty easy. If you have it, then you can do exactly what you are wanting without coding anything.
Hope that helps,
-Blake