Hi i'm a bit new to php and i'm trying to create this contact form. The one issue I am having is the email field is being used as the receiver email and not scpianolessons.ie@gmail.com
Can anyone see where im going wrong?
Thanks.
<?php
$Email = Trim(stripslashes($_POST['Email']));
$Name = Trim(stripslashes($_POST['Name']));
$Number = Trim(stripslashes($_POST['Tel']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=../php/contactthanks.php\">";
exit;
}
// prepare email body text
$to = "$Email";
$from = "scpianolessons.ie@gmail.com";
$subject = "Piano Lessons";
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "
";
$Body .= "Number: ";
$Body .= $Number;
$Body .= "
";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "
";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "
";
// send email
$success = mail($to, $Subject, $Body, "From: <$Email>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=../php/contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>