You could do like this:
form.html:
<html>
<head>
<title>Form</title>
</head>
<body>
<form action="form.php" method="post">
Name: <input type="text" name="name"><br>
City: <input type="text" name="city"><br>
<br>
<input type="submit" value="submit">
</form>
</body>
</html>
form.php:
<?php
$create = touch("result.html");
$open = fopen("result.html",'w');
$write = fwrite($open,"<html>
<head>
<title>Results</title>
</head>
<body>
Hello, $name, you live in $city.
</body>
</html>");
$close = fclose($open);
?>
I'm a newbie myself, but this is how i would have done it.