-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontactFormHandler.php
55 lines (47 loc) · 1.22 KB
/
contactFormHandler.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
<?php
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$to_email = '[email protected]';
$subject = 'Contact Form';
$headers ="";
$htmlTemplate = '<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>';
$htmlTemplate.='<table>
<thead>
<th>Name</th>
<th>Email</th>
<th>Contact No</th>
<th>Message</th>
</thead>';
$htmlTemplate.='
<tbody>
<tr><td>'.$name.'</td><td>'.$email.'</td><td>'.$subject.'</td></tr>
</tbody>
</table>
<h3>Message : </h3>
<h4> '.$message.'</h4>
</body>
</html>';
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
//$headers .= 'From: [email protected]'; //optional
mail($to_email,$subject,$htmlTemplate,$headers);
echo "<script type='text/javascript'>";
echo "alert('Your Information Succesfully Submited ');";
echo "window.location.href='../index.html';";
echo "</script>";
?>