-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.php
29 lines (22 loc) · 879 Bytes
/
mail.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
<?php
if (isset($_POST['submit'])) {
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$mailFrom = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mailTo = "[email protected]";
$headers = "From: ".$mailFrom;
$txt = "First Name: ".$firstname."\r\nLast Name: ".$lastname."\r\nEmail: ".$mailFrom."\r\nSubject: ".$subject."\r\nMessage: ".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: contact.php?mailsent");
$mysqli = mysqli_connect('localhost', 'tigerstylebd', 'tsbl1971', 'tigerstylebd');
if ($mysqli) {
echo "Connection Successful";
} else {
echo "No Connection";
}
$query = "INSERT INTO `mail`(`first_name`, `last_name`, `email`, `subject`, `message`) VALUES ('$firstname','$lastname','$mailFrom','$subject','$message')";
mysqli_query($mysqli, $query);
}
?>