-
Notifications
You must be signed in to change notification settings - Fork 21
/
validateContactInput.php
46 lines (38 loc) · 1.22 KB
/
validateContactInput.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
44
45
46
<?php
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$tel = $order = "";
$recaptchaCriteria = "";
$sendCriteria = "";
$errorCriteria = "";
if($_SERVER['REQUEST_METHOD'] == "POST")
{
$name = $_POST['customerName'];
$email = $_POST['customerEmail'];
$message = $_POST['customerMessage'];
if(isset($_POST['customerPhone']))
{
$phone = $_POST['customerPhone'];
$tel = "<br>Phone: ". test_input($phone) . "<br>";
}
if(isset($_POST['orderNumber']))
{
$orderNumber = $_POST['orderNumber'];
$order = "<br>Order Number: " . test_input($orderNumber) . "<br>";
}
$to = "[email protected]";
$subject = "Contact Form from $name";
$note = $message . $tel . $order;
$headers = "From: $email \r\n";
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
mail($to, $subject, $note, $headers);
echo "Message Sent";
} else {
echo "Message Not Sent!";
}
?>