-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContactUs.php
84 lines (65 loc) · 3.29 KB
/
ContactUs.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
81
82
83
84
<?php
include_once ('Include/connection.php');
// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Retrieve the form data
$fstname = $_POST['firstname'];
$lstname = $_POST['lastname'];
$tel = $_POST['tel'];
$subject = $_POST['subject'];
// Validate the form data
if (empty($fstname) || empty($lstname) || empty($tel) || empty($subject)) {
echo "Please fill in all fields.";
}
// Prepare and execute the SQL statement to insert the review
$query = "INSERT INTO contactus(fname, lname, tel, text) VALUES ('{$fstname}', '{$lstname}', '{$tel}', '{$subject}')";
$result = mysqli_query($connection, $query);{
// Check if the insertion was successful
if ($result) {
//successfull message
echo " submitted successfully.";
mysqli_close($connection);
echo '<script>alert("contact form submitted successfully.");</script>';
echo '<script>window.location.href = "ContactUs.php";</script>';
exit;
} else {
echo "Error submitting the review.";
}
// Close the database connection
mysqli_close($connection);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Recipe world | Contact us
</title>
<link rel="stylesheet" href="ContactUs.CSS">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<!--include header-->
<?php include_once 'header.php'?>
<div class="container">
<h1 style="text-align: center;">Contact Us</h1>
<form method="POST" action="ContactUs.php" >
<label for="fname">First Name</label>
<input type="text" id="firstname" name="firstname" placeholder="Your name..">
<label for="lname">Last Name</label>
<input type="text" id="lastname" name="lastname" placeholder="Your last name..">
<label for="tel">Tel No</label>
<input type="text" id="tel" name="tel" placeholder="Your tel no...">
<label for="subject">Subject</label>
<textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>
<input type="submit" value="Submit" >
</form>
</div>
<div class="container1">
<div class="mapouter"><div class="gmap_canvas"><iframe class="gmap_iframe" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?width=600&height=450&hl=en&q=sliit malabe&t=&z=14&ie=UTF8&iwloc=B&output=embed"></iframe><a href="https://capcuttemplate.org/">Capcuttemplate.org</a></div></div>
</div>
<?php include_once './footer.php';?>
</body>
</html>