The following code will make you able to store form data(user name in my example ) in microsoft word file. It will create ms word file too that if file is not created before.
$username = $_POST['username'];
$fp = fopen("myfile.doc","a+") or exit("unable to open the file");
if($fp != null)