Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $errors = array();
- $name = isset($_POST['name']) ? $_POST['name'] : "";
- $email = isset($_POST['email']) ? $_POST['email'] : "";
- $web = isset($_POST['web']) ? $_POST['web'] : "";
- $favwork = isset($_POST['favwork']) ? $_POST['favwork'] : "";
- $message = isset($_POST['message']) ? $_POST['message'] : "";
- if (isset($_POST['submit']))
- {
- if (empty($name)) {
- $errors['name'] = 'Please enter your name.';
- }
- if (empty($email)) {
- $errors['email'] = 'Please enter your e-mail.';
- }
- if (empty($web)) {
- $errors['web'] = 'Please enter your web address.';
- }
- $to = "b.enlevygraphics@gmail.com";
- $headers = "From: " . $email;
- $subject = "Ben, you have been contacted...";
- $body = "Name: " . $name . "\nEmail: " . $email . "\nWebsite: " . $web . "\n" . "\nFavorite Piece of work: " . $favwork . "\n" . "\nMessage: " . $message;
- if(!count($errors) && mail($to, $subject, $body, $headers)) {
- $to = $email;
- $headers = "From: be.nlevygraphics@gmail.com" ;
- $subject = "You contacted benlevywebdesign";
- $body = $_POST['name'].", Thank you for taking a look at my portfolio and contacting me. I have received your contact information/message and I will get back to you as soon as I can!" . "\n" . "\nFor your records I have:" . "\nEmail: " . $email . "\n" . "\nFavorite Piece of work: " . $favwork . "\n" . "\nMessage: " . $message;
- if (mail($to, $subject, $body, $headers)) {
- echo("<p class=contactformsent>".$name.", your information was received. For your records an email has also been sent to you!</p>");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement