Hola espero que este script te ayude aunque no entiendo porque lo deseas guardar en un fichero en vez de una base de datos;
<html>
<head>
<?
if(grabar){
//creo el fichero
$fichero = fopen("datos_form.txt","w");
//escribo el nombre
fwrite($fichero,$nombre);
//salto de linea
fwrite($fichero,"\r\n");
//escribo el email
fwrite($fichero,$email);
//cierro el fichero
fclose($fichero);
$para = '
[email protected]';
$asunto = 'el asunto';
$mensaje = "Este es el nombre: $nombre \r\n Este es el email: $email";
$cabeceras = 'From:
[email protected]' . "\r\n" .
'Reply-To:
[email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//envio el email
mail($para, $asunto, $mensaje, $cabeceras);
}
?>
</head>
<body>
<table align="center">
<form action="" method="POST">
<tr>
<td>Nombre</td>
<td><input type="text" name="nombre"></td>
</tr>
<tr>
<td>Correo</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="grabar"></td>
</tr>
</form>
</table>
</body>
</html>