-
Notifications
You must be signed in to change notification settings - Fork 0
/
feedback.php
40 lines (31 loc) · 1.17 KB
/
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
37
38
39
40
<?php
//Connect to db
include_once "connect.php";
$valid = true; // start with valid being true
// Check if feedbackMessage post variable are set
if (isset($_POST["feedbackMessage"])) {
$feedbackMessage = trim($_POST["feedbackMessage"]); // set feedback message var and trim
$gridid = $_POST["gridid"];
$email = $_POST["email"];
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
//Send email to Feedback Team
$subject = "Feedback from User: " . $firstName; //user's name
$to = "[email protected]";
$message = "FROM: " . $firstName . " " . $lastName . " (GridID: " . $gridid . ")"
."\r\n" . "EMAIL: " . $email
. "\r\n \r\n" . "FEEDBACK: " . $feedbackMessage;
$headers = "From: CampusGrids App" . "\r\n" . "Feedback: ";
//mail(to,subject,message,headers,parameters)
mail($to,$subject,$message,$headers);
$arr = array('status' => 1);
}
else {
$valid = false;
}
if (!$valid) {
$arr = array('status' => 0); // Create error array if not valid
}
$mysqli->close(); // Close connection
echo json_encode($arr); // echo the output (JSON) which will be interpreted in javascript as an object
?>