Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['myname'])) { $myname = $_POST['myname']; }
- if (isset($_POST['mypassword'])) { $mypassword = $_POST['mypassword']; }
- if (isset($_POST['mypasswordconf'])) { $mypasswordconf = $_POST['mypasswordconf']; }
- if (isset($_POST['mycomments'])) {
- $mycomments = filter_var($_POST['mycomments'], FILTER_SANITIZE_STRING );
- }
- if (isset($_POST['reference'])) { $reference = $_POST['reference']; }
- if (isset($_POST['favoritemusic'])) { $favoritemusic = $_POST['favoritemusic']; }
- if (isset($_POST['requesttype'])) { $requesttype = $_POST['requesttype']; }
- $formerrors = false;
- if ($myname === '') :
- $err_myname = '<div class="error">Sorry, your name is a required field</div>';
- $formerrors = true;
- endif; // input field empty
- if (strlen($mypassword) <= 6):
- $err_passlength = '<div class="error">Sorry, the password must be at least six characters</div>';
- $formerrors = true;
- endif; //password not long enough
- if ($mypassword !== $mypasswordconf) :
- $err_mypassconf = '<div class="error">Sorry, passwords must match</div>';
- $formerrors = true;
- endif; //passwords don't match
- if ( !(preg_match('/[A-Za-z]+, [A-Za-z]+/', $myname)) ) :
- $err_patternmatch = '<div class="error">Sorry, the name must be in the format: Last, First</div>';
- $formerrors = true;
- endif; // pattern doesn't match
- if (!($formerrors)) :
- $to = "patrickjmcd121@gmail.com";
- $subject = "From $myname -- Contact/Booking Page";
- $message = "$myname filled out the form";
- $headers = 'MIME-Version: 1.0' . "rn";
- $headers .= 'From: Patrick <patrickjmcd121@gmail.com>' . "rn";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
- $replyto = "From: $email rn".
- "Reply-To: mshaun.mcdermott@ntlworld.com" . "rn";
- if (mail($to, $subject, $message, $headers)):
- $msg = "Thanks for filling out our form";
- else:
- $msg = "Problem sending the message";
- endif; // mail form data
- endif; // check for form errors
- endif; //form submitted
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement