Well you know that your html code isn't going to change so you can make those static print statments.
<?php
//so grab your varibles
$titleVaribleName= $GET[formfieldnamefortitle];
$headerVaribleName= $GET[formfieldnameforheader];
//now print them
print ("<html>");
print ("<head> ");
print ("<title>$titleVaribleName</title>
print ("</head> ");
print ("<body> ");
print ("<H1>$headerVaribleName</H1> ");
print ("</body>");
print ("</html> ");
?>
Something close to that. If I am understanding you correctly.