Here's a PHP approach - you can probably translate it to another language, too.
<?php
// This just names the file
$target_filename = "textfile";
// Create an empty buffer
$message = "";
// This gets all the form keys (names) and values
foreach ($_POST as $key => $value)
$message .= "$key: $value\n";
// Put the date in
$message .= date("F j, Y, g:i a");
// Open the file and write it out
$fp = @fopen($target_filename,"wt");
if ($fp != NULL)
{
fputs($fp,$message);
fclose($fp);
}
?>