-
Notifications
You must be signed in to change notification settings - Fork 1
/
comment.php
33 lines (24 loc) · 886 Bytes
/
comment.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
<?php
session_start();
include "connect.php";
include "functions.php";
$user_data = check_login($conn);
$id = $_SESSION['user_id'];
echo $id;
if(isset($_POST['postNewComment'])) {
// get from
$event_id = $_POST['event_id'];
$user_comment= $_POST['comment'];
// echo "$id";
// insert to database
$query = "INSERT INTO forum(`user_id`,`user_comment`,`event_id`) VALUES ('$id','$user_comment','$event_id')";
$result = mysqli_query($conn, $query);
if($result){
// after submitting the comment, redirect to the view.php event page
header("Location:view.php?view=" . $event_id);
// header("Location:view.php?view='$event_id'");
}else{
echo("ERROR: ".$query."<br>".mysqli_error($conn));
}
}
?>