Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $errors = '';
- $myemail = 'matexoza@gmail.com';//<-----Put Your email address here.
- if(empty($_POST['name']) ||
- empty($_POST['email']) ||
- empty($_POST['phone']) ||
- empty($_POST['message']))
- {
- $errors .= "\n Error: all fields are required";
- }
- $name = $_POST['name'];
- $email_address = $_POST['email'];
- $phone = $_POST['phone'];
- $message = $_POST['message'];
- if (!preg_match(
- "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
- $email_address))
- {
- $errors .= "\n Error: Invalid email address";
- }
- if( empty($errors))
- {
- $to = $myemail;
- $email_subject = "Contact form submission: $name";
- $email_body = "You have received a new message. ".
- " Here are the details:\n Name: $name \n Email: $email_address \n Phone: $phone \n Message \n $message";
- $headers = "From: $myemail\n";
- $headers .= "Reply-To: $email_address";
- mail($to,$email_subject,$email_body,$headers);
- //redirect to the 'thank you' page
- header('Location: contact-form-thank-you.html');
- }
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <title>mattiesweb.com</title>
- <meta name="view" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="css/bootstrap.min.css">
- <link rel="stylesheet" href="css/styles.css">
- <style type="text/css">body { background: ; }</style>
- </head>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement