-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontactUs.php
174 lines (124 loc) · 4.78 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php include("config2.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<link rel="stylesheet" href="DreamTourCss.css ">
<style>
body{
width:100%;
min-height:100vh;
background-image:linear-gradient(rgba(0,0,0,.3),rgba(0,0,0,.3)) ,url(travelimages/elephants1.jpeg);
background-position:center;
background-size: cover;
display:flex;
justify-content: center;
align-items: center;
background-repeat: no-repeat;
}
.contact_us{width: 400px;
height: 400px;
background: #fff;
border-radius: 5px;
box-shadow:0 0 5px rgba(0,0,0,0.5);
padding:40px 30px;
position:absolute;
top:30%;
left: 36%;
justify-content: center;
align-items: center; }
</style>
</head>
<body>
<div class="topnav">
<a href="homenew.php">Home</a>
</div>
<div>
<div class="col">
<div class="contact_us">
<p class="login-text" style="font-size: 2rem; font-weight: 800;">Contact Us</p>
<form method="post" enctype="multipart/form-data">
<table class="table table-striped">
<tr>
<td>Name</td> <td><input type="text" name ="txtName" required
<?php
if(isset($_POST["btnEdit"]))
{
$r=$_POST["btnEdit"];
echo'value="'.$_POST["pName"][$r].'"';
}
?>
>
<?php
if(isset($_POST["btnEdit"]))
{
$r =$_POST["btnEdit"];
echo '<input type="hidden"
name="txtID" value="'. $_POST["pId"][$r].'">';
}
?>
</td>
</tr>
<tr>
<td>Email</td> <td><input type="email" name ="txtPeriod"
<?php
if(isset($_POST["btnEdit"]))
{
$r=$_POST["btnEdit"];
echo'value="'.$_POST["pPeriod"][$r].'"';
}
?>></td>
</tr>
<tr>
<td>Message</td> <td><textarea name="txtDescrip" col="14" rows="5" required>
<?php
if(isset($_POST["btnEdit"]))
{
$r =$_POST["btnEdit"];
echo $_POST["pDescrip"][$r];
}
?>
</textarea></td>
</tr>
<td></td> <td>
<button type="submit" class="btn btn-success" name="btnSave">Send</button>
</td>
</tr>
</table>
</form>
<?php
if($_SERVER["REQUEST_METHOD"] == "POST")
{
if(isset($_POST['btnSave']))
{
try
{
$conn = new PDO($db,$un,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$query ="INSERT INTO `contact`(`Name`, `Email`, `Message`)
VALUES (?,?,?)";
$st = $conn->prepare($query);
$st->bindValue(1,$_POST["txtName"],PDO::PARAM_STR);
$st->bindValue(2,$_POST["txtPeriod"],PDO::PARAM_STR);
$st->bindValue(3,$_POST["txtDescrip"],PDO::PARAM_STR);
$st->execute();
echo "<script>alert('Message sent successfully.')</script>";
} catch (PDOException $th) {
echo $th->getMessage();
}
}
}
?></div>
</div>
</div>
</div>
</div></footer>
<div class="f_copyright ">© 2022 Copyright: DreamTourSriLanka.lk
</div>
</body>
</html>