This idea has
+ been closed. You
+ can still comment on this idea but it will be reviewed by
+ the
+ admin.
+
+
+
+
+
+
+
You can
+ comment
+ on this idea.
+
+
+
+
+
+
+
+
+
-
-
-
-
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus provident totam
- velit optio,
- reprehenderit in impedit quidem, doloremque esse eos officiis, voluptas nobis maxime
- minima?
- Perspiciatis soluta enim veritatis neque!
+
+
+
-
-
-
-
-
-
-
-
+ $sql = "INSERT INTO Comment (CommentContent, StaffID, IdeaID, is_anonymous, CommentDate) VALUES ('$content', '$staffID', '$ideaID', '$isAnonymous', '$commentDate')";
+ if (mysqli_query($conn, $sql)) {
+ // The author of an idea receives an automatic email notification whenever a comment is submitted to any of their ideas.
+ $sql2 = "SELECT * FROM Idea WHERE IdeaID = '$ideaID'";
+ $result2 = mysqli_query($conn, $sql2);
+ $row2 = mysqli_fetch_assoc($result2);
+ $authorID = $row2['StaffID'];
+ $sql3 = "SELECT * FROM Staff WHERE StaffID = '$authorID'";
+ $result3 = mysqli_query($conn, $sql3);
+ $row3 = mysqli_fetch_assoc($result3);
+ $authorEmail = $row3['Email'];
+ $authorName = $row3['StaffName'];
+ $to = $authorEmail;
+ $subject = "New comment on your idea";
+ $message = "Dear " . $row3['StaffName'] . ",
A new comment has been submitted to your idea $row2[Title].
";
+ $message .= 'Comment: ' . $content . '
';
+ $message .= 'Please login to your account to view the comment.