-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontact-form.php
More file actions
35 lines (28 loc) · 932 Bytes
/
Copy pathcontact-form.php
File metadata and controls
35 lines (28 loc) · 932 Bytes
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
<?php
// PHP CONFIG
$_SERVER["REQUEST_METHOD"] == "POST";
$hostname = "db5002129461.hostin-data.io";
$username = "dbu96360";
$password = "KQ6UHi&Jn?kWKPpXv-!";
$db = "dbs1727879";
// connects to DB
$dbconnect=mysqli_connect($hostname,$username,$password,$db);
if ($dbconnect->connect_error) {
die("Database connection failed: " . $dbconnect->connect_error);
}
if(isset($_POST['submit'])) {
$surname=$_POST['surname'];
$firstname=$_POST['firstname'];
$adress=$_POST['adress'];
$email=$_POST['email'];
$dropdown=$_POST['dropdown'];
$comment=$_POST['comment'];
$query = "INSERT INTO user_review (surname, firstname, adress, email, dropdown, comment)
VALUES ('$surname', '$firstname', '$adress', '$email', '$dropdown', '$comment')";
if (!mysqli_query($dbconnect, $query)) {
die('An error occurred. Your review has not been submitted.');
} else {
echo "Thanks for your review.";
}
}
?>