-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontactform.php
80 lines (71 loc) · 2.25 KB
/
contactform.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['email'])) {
//Email information
$admin_email = "[email protected]";
$name = $_REQUEST['candidatename'];
$email = $_REQUEST['email'];
$country = $_REQUEST['country'];
$subject = "Appointment for the country - ".$country;
$phonenumber = $_REQUEST['phonenumber'];
$edu = $_REQUEST['edu'];
$comment = $_REQUEST['comment'];
// set content-type for sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: '.$admin_email."\r\n";
$headers .= 'Cc: '.$email."\r\n";
//send email
$body = "Name: ".$name.", Email: ".$email.", Phone Number: ".$phonenumber.", Educational Qualification: ".$edu.", Country wish - ".$country.", Custom Message: ".$comment;
//mail($admin_email, "$subject", $body, "From:" . $email);
mail($admin_email, "$subject", $body, $headers);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
<form method="post">
<table>
<tr>
<td colspan="2">Appointment Fixing Form</td>
</tr>
<tr>
<td>Name</td>
<td><input name="candidatename" type="text"></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" type="text"></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input name="phonenumber" type="text"></td>
</tr>
<tr>
<td>Educational Qualification</td>
<td><input name="edu" type="text"></td>
</tr>
<tr>
<td>Country you wish...</td>
<td>
<select name="country">
<option>Italy</option>
<option>France</option>
<option>Others</option>
</select>
</td>
</tr>
<tr>
<td>Custom Message</td>
<td><textarea name="comment" rows="15" cols="40"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit Form"></td>
</tr>
</table>
</form>
<?php
}
?>