These:
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "info@myemail.com";
$Subject = "Request Form";
$Name = Trim(stripslashes($_POST['Name']));
$City = Trim(stripslashes($_POST['City']));
$PostCode = Trim(stripslashes($_POST['PostCode']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Comments = Trim(stripslashes($_POST['Comments']));
Are NOT arrays. NOTHING you are calling there should be outputting arrays... since it's VERY unlikely that $POST['Name'] is an array -- $POST is an array, but an index into it shouldn't be unless you did something like name="City[]" in the markup, which seems unlikely, as that would throw errors when you try to stripslashes and/or trim them as those are string functions NOT array functions.
Also occurred to me there is no Trim, only trim. Case sensitive language.
It is a bit of a mess -- PHP code before you even open <?php, variables for nothing, stripslashes for nothing (this isn't 2003), multiple string additions to $body when you don't need to do that, etc, etc...
REALLY not sure what that $success variable is even for since you re-assign it on attempting to call mail()... without using it. Makes your entire 'check' pointless.
Guessing slightly, but I suspect what you are trying to do should go a little something like this:
<?php
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');
function headerClean($value) {
return preg_replace('/\s+/', ' ', $value);
}
$fields = ['EmailFrom', 'Name', 'City', 'PostCode', 'Tel', 'Comments'];
$errors = 0;
foreach ($fields as $fieldName) {
if (isset($_POST[$fieldName])) {
if (empty($_POST[$fieldName] = trim(
htmlspecialchars($_POST[$fieldName])
))) $errors++;
} else $errors++;
}
if ($errors == 0) {
$mailTo = 'info@myemail.com';
$mailSubject = 'Request Form';
$mailName = headerClean($_POST['Name']);
$mailMail = headerClean($_POST['EmailFrom']);
$mailFrom = 'Request Form - ' . $mailName . ' <' . $mailMail . '>';
$mailHeaders =
'From: ' . $mailFrom . "\r\n" .
'Reply-To: ' . $mailMail . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$mailBody = '';
foreach ($fields as $fieldName) {
$mailBody .= $fieldName . ': ' . $_POST[$fieldName] . "\r\n";
}
if (mail($mailTo, $mailSubject, $mailBody, $mailHeaders)) {
include('thank-you.html');
exit();
);
}
include('error-message.html');
?>
Skipping those stupid malfing 'header' redirects -- I figure out who's been propagating that halfwit technique of handling PHP results from a function... it's not going to be pretty. Likely not your fault, you're learning from a bad source!
Though really I'd have a lot more going on there in terms of checks, and callbacks to the originating form. See this mailer I did here for someone:
http://www.cutcodedown.com/for_others/KaleemUllahHashmi/
Which is far, far more robust in what it does. (the .source files are, well... the source).