<?php
    if( $_SERVER['REQUEST_METHOD']=='POST' ){
        $filename=__DIR__ . '\\file.txt';
        file_put_contents( $filename, implode( PHP_EOL,$_POST ) . PHP_EOL, FILE_APPEND );
        exit();
    }
    ?>
<!doctype html>
<html>
<head>
<title>Save Form data to text file</title>
</head>
<body>
<form id="some" name="someName" method="post">
<input type="text" id="some1" class="someClass" value="" name="fileWrite"/>
<input type="submit" value="submit" class="submitClass"/>
</form>
</body>
</html>
