-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformhandler.php
More file actions
65 lines (48 loc) · 1.09 KB
/
Copy pathformhandler.php
File metadata and controls
65 lines (48 loc) · 1.09 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
ob_start();
$name = '';
$email = '';
$gender = '';
$wines = '';
$gender = '';
$regions = '';
$comments = '';
if($_SERVER['REQUEST_METHOD'] == 'POST') {
if(isset($_POST['name'],
$_POST['email'],
$_POST['gender'],
$_POST['wines'],
$_POST['regions'],
$_POST['comments'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$wines = $_POST['wines'];
$regions = $_POST['regions'];
$comments = $_POST['comments'];
function my_wines($wines) {
$my_return = '';
if(!empty($_POST['wines'])) {
$my_return = implode(', ', $_POST['wines']);
}
return $my_return;
}
$to = 'youremail@email.com';
$subject = 'Test Email on ' .date('m/d/y, h i A');
$body = '
Name : '.$name.' '.PHP_EOL.'
Email : '.$email.' '.PHP_EOL.'
Gender : '.$gender.' '.PHP_EOL.'
Region : '.$regions.' '.PHP_EOL.'
Wines : '.my_wines($wines).' '.PHP_EOL.'
Comments : '.$comments.' '.PHP_EOL.'
';
$headers = array(
'From' => 'noreply@mystudentswa.com'
);
if(!empty($name && $email && $gender && $wines && $regions && $comments)) {
mail($to, $subject, $body, $headers);
header('Location:thx.html');
}
}
}