forms.php 946 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. $errorMSG = "";
  3. if (empty($_POST["name"])) { $errorMSG = "Name is required "; } else { $name = $_POST["name"]; }
  4. if (empty($_POST["email"])) { $errorMSG .= "Email is required "; } else { $email = $_POST["email"]; }
  5. if (empty($_POST["phone"])) { $errorMSG .= "Phone is required "; } else { $email = $_POST["email"]; }
  6. if (empty($_POST["message"])) { $errorMSG .= "Message is required "; } else { $message = $_POST["message"]; }
  7. $EmailTo = "info@biothermsolutions.com";
  8. $Subject = "Contact Form (biothermsolutions.com)";
  9. $Body = "";
  10. $Body .= "Name: ";
  11. $Body .= $name;
  12. $Body .= "\n";
  13. $Body .= "Email: ";
  14. $Body .= $email;
  15. $Body .= "Phone: ";
  16. $Body .= $phone;
  17. $Body .= "\n";
  18. $Body .= "Message: ";
  19. $Body .= $message;
  20. $Body .= "\n";
  21. $success = mail($EmailTo, $Subject, $Body, "From:".$email);
  22. if ($success && $errorMSG == ""){ echo "success";}
  23. else {
  24. if($errorMSG == ""){ echo "Something went wrong :("; }
  25. else { echo $errorMSG; }
  26. }
  27. ?>