-
Notifications
You must be signed in to change notification settings - Fork 0
/
action_page.php
46 lines (31 loc) · 1.01 KB
/
action_page.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
$servername = "localhost";
$username = "drrenu";
$password = "Windows@10";
$dbname = "renumalik";
$name = $_POST['name'];
$email = $_POST['email'];
$phone1 = $_POST['phone'];
$date1 = $_POST['date'];
// $time1 = $_POST['time'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO form (`name`,`email`,`phone`,`date`)
VALUES ('$name','$email','$phone1','$date1')";
$to = "[email protected]";
$subject = "Website Leads";
$txt = "Name :" . $name . "\n" . "Email:". $email. "\n"."Phone :" . $phone1 . "\n" . "date :" . $date1 ;
$headers = "From: [email protected]". "\r\n" .
$headers .= "MIME-Version: 1.0" . "\r\n";
mail($to,$subject,$txt,$headers);
if ($conn->query($sql) === TRUE) {
echo "<script>window.location.assign('index.html');</script>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>