It is going to consist of two parts. An HTML form and a PHP processing script. You can use javascript or jquery to validate the form before sending, so that all required fields are filled in. This is your generic form:
<form method="POST" action="script.php">
What is your name?
<input type="text" name="userName" />
<input type="submit" value="Submit">
</form>
Here is your generic processing script:
//get the posted name
$userName=$_POST['userName'];
// sample text with placemarker
$text = "Hello <<name>>! Welcome to the site!";
// simple string replace
$newText=str_replace("<<name>>","$userName",$text);
// display the text
echo $newText;
This does not do any string cleaning, nor does it provide any protection against any hacking, but it does show the mechanics of how it works.