-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuserfeedback.php
More file actions
109 lines (102 loc) · 3.5 KB
/
userfeedback.php
File metadata and controls
109 lines (102 loc) · 3.5 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
include( "sessionRedirector.php" );
include( "queryFunctions.php" );
$userid = $_SESSION[ "userid" ];
if ( isset( $_POST[ "btnadd" ] ) ) {
if ( checkUserPlaceFeedbackExist( $userid, $_POST[ "cbplace" ] ) ) {
header( "Location: userfeedback.php?status=feedbackAlreadyExist" );
} else {
if ( addUserPlaceFeedback( $userid, $_POST[ "cbplace" ], $_POST[ "cbrating" ], $_POST[ "formcomment" ] ) ) {
header( "Location: userfeedback.php?status=feedbackAdded" );
} else {
header( "Location: userfeedback.php?status=somethingWentWrong" );
}
}
}
if ( isset( $_POST[ "btnupdate" ] ) ) {
if ( !checkUserPlaceFeedbackExist( $userid, $_POST[ "cbplace" ] ) ) {
header( "Location: userfeedback.php?status=feedbackDoesNotExist" );
} else {
if ( updateUserPlaceFeedback( $userid, $_POST[ "cbplace" ], $_POST[ "cbrating" ], $_POST[ "formcomment" ] ) ) {
header( "Location: userfeedback.php?status=feedbackUpdated" );
} else {
header( "Location: userfeedback.php?status=somethingWentWrong" );
}
}
}
if ( isset( $_POST[ "btnremove" ] ) ) {
if ( !checkUserPlaceFeedbackExist( $userid, $_POST[ "cbplace" ] ) ) {
header( "Location: userfeedback.php?status=feedbackDoesNotExist" );
} else {
if ( removeUserPlaceFeedback( $userid, $_POST[ "cbplace" ] ) ) {
header( "Location: userfeedback.php?status=feedbackRemoved" );
} else {
header( "Location: userfeedback.php?status=somethingWentWrong" );
}
}
}
include( "userDashboardHeader.php" );
?>
<div class="breadcrumbs">
<div class="col-sm-4">
<div class="page-header float-left">
<div class="page-title">
<h1>
<?php
if (isset($_GET["status"])) {
//var_dump($_GET);
echo $_GET["status"];
}
?>
</h1>
</div>
</div>
</div>
</div>
<div class="content mt-3">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><strong>User Feedback</strong>
</div>
<div class="card-body card-block">
<form method="post" action="userfeedback.php">
<div class="form-group">
<label for="vat" class=" form-control-label">Place Name</label>
<br>
<select name="cbplace" id="activities" class="form-control">
<?php
global $connection;
$query = "SELECT * FROM places ORDER BY placename";
$results = mysqli_query( $connection, $query );
while ( $row = mysqli_fetch_assoc( $results ) ) {
echo( "<option value = '" . $row[ "placeid" ] . "' >" . $row[ "placename" ] . " </option>" );
}
?>
</select>
<br>
<div class="row form-group">
<div class="col-md-3">
<label for="vat">Place Ratings</label>
<select name="cbrating" id="activities" class="form-control">
<?php
for ( $i = 1; $i <= 10; $i++ ) {
echo( "<option value='" . $i . "'>" . $i . "</option>" );
}
?>
</select>
</div>
</div>
<label for="vat" class=" form-control-label">Any Comments</label>
<input type="text" id="vat" placeholder="Enter your comments" name="formcomment" class="form-control col-lg-12">
<br>
<button id="payment-button" type="submit" name="btnadd" class="btn btn-lg btn-info col-lg-2">Add</button>
<button id="payment-button" type="submit" name="btnupdate" class="btn btn-lg btn-info col-lg-2">Update</button>
<button id="payment-button" type="submit" name="btnremove" class="btn btn-lg btn-info col-lg-2">Remove</button>
</div>
</form>
</div>
</div>
<!-- .content -->
</div>
</div>
<?php include( "userDashboardFooter.php" ); ?>