<?php
if (array_key_exists('text', $_POST)) {
$f = fopen('file.txt', 'a');
fwrite($f, $_POST['text'] . "\n");
fclose($f);
}
?>
<html>
<head>
<title></title>
</head>
<body>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" name="text" value="">
<input type="submit" value="Записать строчку">
</form>
</body>
</html>