Thanks for the help, I moved that below, or just deleted it for now. My last line of code ($result...) is still highlighted like it didn't fix the problem.
I'm not sure what is causing the error you're getting but all of your 'if' and 'elseif' statements are wrong because a single '=' is an assignment, not a comparison. Should be:
The Header directive is an HTML directive not PHP. It belongs outside the closing PHP tag. Try the code below.
$result = $mailer->send($message);
?>
header("Location: HTTP://domain/thank-you.html")
Best regards,
AielloJ