-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.php
43 lines (32 loc) · 1.27 KB
/
about.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php include_once("ourStory.html");
if (empty($_POST) === false) {
// echo("submitted");
$errors = array();
$name = $_POST["name"];
$email = $_POST["email"];
$emailSubject = $_POST["emailSubject"];
$message = $_POST["message"];
if (empty($name) === true || empty($email) === true || empty($emailSubject) === true || empty($message) === true) {
$errors[] = "Please fill out all of the fields";
}
else {
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
$errors[] = "Invalid email address, please review";
}
if (ctype_alpha($name) === false ) {
$errors[] = "Name field can only contain letters";
}
}
if (empty($errors) === false) {
echo "<ul>";
foreach ($errors as $error) {
echo "<li>", $error, "</li>";
}
echo "</ul>";
}
if (empty($errors) === true) {
mail("hannah@purejoybody.com", $emailSubject, $message, "From: " . $email);
exit();
}
}
?>