I have searched the boards and read all I could find on the subject. It is how I was able to figure out how to make it work… kind of. I am having a specific issue that I could not find an answer to in the other posts that I read through, so I am hoping someone can help me solve my small issue.
My specific issue is having the form show the success or error message that I formatted in Webflow once the form is submitted. At the moment, when the form is submitted it just reloads the page without any success or error messages.
Here is the PHP code I am using for the mail file:
<?php $ToEmail = 'email@example.com'; $EmailSubject = 'Form Subject '; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY .= "Name: ".$_POST["name"]."<br>"; $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; $MESSAGE_BODY .= "Subject: ".$_POST["interest"]."<br><br>"; $MESSAGE_BODY .= "Message: ".nl2br($_POST["the_message"])."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?> <script> //alert('Thank you for your submission! We will contact you shortly.'); //location.href='thankyou.html' </script>
The “script” on the bottom is what I used on an older site, but I “//” it on this one because I want to use the success and error messages from the Webflow form.
I don’t know PHP, so this is something I pieced together. So I could very well be missing something little, or doing something demonstrably wrong. Either way, I would appreciate any help. And to any of you PHP whizzes out there, my apologies for my sloppy attempt at speaking your language.
Thank you in advance for any tips and solutions.