You can check if your website is php powered by writing this to test.php file and trying to run it.
PHP Code:
<?php echo "testing...1...2...3..."; ?>
if you can see the text inside " " and not the code itself then you are ok.
Another way to check for php which gives you a bit of extra info also is to write this inside that file
Note that some hosts have disabled the use of phpinfo function but if you need for example the php version or something like that then this is very useful.
The code you showed comes to the beginning of the file. As you can see it checks if the form has been submitted (variable $_POST['emailSubmit'] exists) and if yes then sends the mail. It actually doesn't matter where you put it but it's usefull to put it before your form and then do if else statement where you display a thank you text inside this if like this
Code:
if ($_POST['emailSubmit']){
$body = "The following information was just submitted by a user: \n\n Full Name: " . $_POST['name'] . "\n Address: " . $_POST['address'] . "\n City: " . $_POST['city'] . "\n State: " . $_POST['state'] . "\n Age: " . $_POST['age'] . "\n Comment: " . $_POST['comment'];
mail($_POST['emailTo'], "Replace this with what you want the subject to be", $body);
// Thank you text
echo "thank you for sending the mail";
else {
// Show the form just like before
}