try this:
create first the file log.txt and give the writing permission
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</head>
<body>
<?php
if(isset($_POST['submit'])) //check for form submission
{
//compile the information to store within the textfile
$str_tofile = "Name:".$_POST['name']."\n";
$str_tofile.= "Other Blurb:".$_POST['blurb']."\n";
//open a file pointer to the text file where you want to save the submitted form data
$filepointer = fopen('log.txt','a+');
//save the submitted form data to the file
fwrite($filepointer,$str_tofile);
//thank the user
echo "Data has been saved to text file. Thanks!";
}
else //if the form has not been submitted then echo out the form.
{
?>
<form name="form1" method="post" action="testform.php">
<table width="346" height="110" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Name</td>
<td><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>Other blurb</td>
<td><input name="blurb" type="text" id="blurb"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>