-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfeedback.php
36 lines (27 loc) · 900 Bytes
/
feedback.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
<?php
session_start();
require "vendor/autoload.php";
if (isset($_POST["name"])) {
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];
try {
$m = new MongoDB\Client("mongodb://vinay0410:[email protected]:23725/pizza");
$db = $m->pizza;
$collection = $db->feedback;
} catch (Exception $e) {
$error_msg = "Couldn't Connect to Database";
}
if (empty($error_msg)) {
$document = array(
"name" => $name,
"email" => $email,
"subject" => $subject,
"message" => $message,
);
$collection->insertOne($document);
$_SESSION["feedback_msg"] = "Feedback Submitted Successfully, Thanks for your time!";
header("Location: .");
}
}