Could anyone tell me if there is something wrong with the code or a better way to modify it? for some reason when i hit submit on my contact form it displays the "error.html" page but i still get an email sent to my account.
$EmailTo = "[email protected]";
$Subject = "Contact Submission";
$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['email']));
$Budget = Trim(stripslashes($_POST['budget']));
$Message = Trim(stripslashes($_POST['message']));
// prepare email body text
$Body = 'Contact Submission'."\n";
$Body .= 'Name: ' .$Name."\n";
$Body .= 'Email: ' .$Email."\n";
$Body .= 'Budget: ' .$Budget."\n";
$Body .= 'Message: ' .$Message."\n";
// send email
$success_email = mail($EmailTo, $Subject, $Body, "From: <$Email>");
// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
header ('location:thankyou.html');
}
else{
header ('location:error.html');
}