-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewComment.php
More file actions
227 lines (218 loc) · 11.2 KB
/
Copy pathnewComment.php
File metadata and controls
227 lines (218 loc) · 11.2 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
include_once 'header.php';
require_once 'include.php';
$pid = $_GET['pid'];
$projid = $_GET['projid'];
$written = $_GET['written'];
$username = $_SESSION['username'];
$sql = "SELECT u_id FROM user WHERE username='$username'";
$result = mysqli_query($link,$sql);
$result = mysqli_fetch_assoc($result);
$uid = implode("",$result);
if ($written!="false")
{
$sql = "SELECT c_teacher, c_project, c_workload FROM comments WHERE u_id='$uid' AND p_id='$pid' AND proj_id='$projid'";
$result = mysqli_query($link,$sql);
$result = mysqli_fetch_assoc($result);
$cprof = $result['c_teacher'];
$cproj = $result['c_project'];
$cwl = $result['c_workload'];
$sql = "SELECT star FROM professor WHERE p_id='$pid'";
$result = mysqli_query($link,$sql);
$result = mysqli_fetch_assoc($result);
$rating = implode("",$result);
}
?>
<div class="write-page">
<h3>Write a New Comment</h3>
<div class="container">
<?php
echo "<form action=\"handleComment.php?pid=$pid&projid=$projid\" method=\"post\" id=\"comment-form\">";
?>
<div class="row">
<!--selection of department-->
<div class="form-group">
<div class="col-md-5 write sel">
<label for="selDept">Department</label>
<?php
$query = "SELECT DISTINCT department FROM professor WHERE p_id='$pid'";
$result = mysqli_query($link,$query);
$result = mysqli_fetch_assoc($result);
$resultDept = implode("",$result);
echo "<input type=\"text\" class=\"form-control\" id=\"selDept\" name=\"dept\" value='$resultDept' disabled />";
?>
</div>
</div>
<!--end selection of department-->
<!--professor name-->
<div class="form-group">
<div class="col-md-5 write sel">
<label for="prof">Professor</label>
<?php
$query = "SELECT DISTINCT name FROM professor WHERE p_id='$pid'";
$result = mysqli_query($link,$query);
$result = mysqli_fetch_assoc($result);
$resultProf = implode("",$result);
echo "<input type=\"text\" class=\"form-control\" id=\"prof\" name=\"prof\" value='$resultProf' disabled />";
?>
<!--<p>Full name of professor</p>-->
</div>
</div>
</div>
<!--proj-name-->
<div class="row">
<div class="form-group">
<div class="col-md-5 write">
<label for="proj">Project</label>
<?php
$query = "SELECT DISTINCT proj_name FROM project WHERE p_id='$pid' and proj_id='$projid'";
$result = mysqli_query($link,$query);
$result = mysqli_fetch_assoc($result);
$resultProj = implode("",$result);
echo "<input type=\"text\" class=\"form-control\" id=\"proj\" name=\"proj\" value='$resultProj' disabled/>";
?>
</div>
<!--email-->
<div class="form-group">
<div class="col-md-5 write">
<label for="email">E-mail</label>
<?php
$query = "SELECT DISTINCT email FROM professor WHERE p_id='$pid'";
$result = mysqli_query($link,$query);
$result = mysqli_fetch_assoc($result);
$resultEmail = implode("",$result);
echo "<input type=\"text\" class=\"form-control\" id=\"email\" name=\"email\" value='$resultEmail' disabled />";
?>
</div>
</div>
</div>
</div>
<!--project description-->
<div class="row">
<div class="form-group">
<div class="col-md-11 write">
<label for="desc">Project Description</label>
<?php
$query = "SELECT DISTINCT description FROM project WHERE p_id='$pid' and proj_id='$projid'";
$result = mysqli_query($link,$query);
$result = mysqli_fetch_assoc($result);
$resultDesc = implode("",$result);
echo "<textarea class=\"form-control\" rows=\"8\" id=\"desc\" name=\"proj-desc\" disabled>$resultDesc</textarea>";
?>
</div>
</div>
</div>
<!--End of project description-->
<!--Rating-->
<div class="row">
<div class="form-group">
<div class="col-md-11 write">
<label for="rate">Rating for This Professor</label>
<div id="rate">
<label class="radio-inline" id="rate-number">
<?php
echo "<input type=\"hidden\" name=\"written\" value='$written' />";
if ($written!="false"){
echo "<input type=\"hidden\" name=\"rating\" value='$rating' />";
echo"<input type=\"radio\" name=\"rating\" value=\"1\" disabled />";
}
else
echo"<input type=\"radio\" name=\"rating\" value=\"1\" required />";
?>
1
</label>
<label class="radio-inline" id="rate-number">
<?php
if ($written!="false")
echo"<input type=\"radio\" name=\"rating\" value=\"2\" disabled />";
else
echo"<input type=\"radio\" name=\"rating\" value=\"2\" required />";
?>
2
</label>
<label class="radio-inline" id="rate-number">
<?php
if ($written!="false")
echo"<input type=\"radio\" name=\"rating\" value=\"3\" disabled />";
else
echo"<input type=\"radio\" name=\"rating\" value=\"3\" required />";
?>
3
</label>
<label class="radio-inline" id="rate-number">
<?php
if ($written!="false")
echo"<input type=\"radio\" name=\"rating\" value=\"4\" disabled />";
else
echo"<input type=\"radio\" name=\"rating\" value=\"4\" required />";
?>
4
</label>
<label class="radio-inline" id="rate-number">
<?php
if ($written!="false")
echo"<input type=\"radio\" name=\"rating\" value=\"5\" disabled />";
else
echo"<input type=\"radio\" name=\"rating\" value=\"5\" required />";
?>
5
</label>
</div>
</div>
</div>
</div>
<!--End of rating-->
<!--Comment-->
<div class="row">
<div class="form-group">
<div class="col-md-11 write">
<label for="c-prof">Comment on Professor</label>
<?php
if($written!="false")
echo"<textarea class=\"form-control\" rows=\"8\" id=\"c-prof\" name=\"c-prof\">$cprof</textarea>";
else
echo"<textarea class=\"form-control\" rows=\"8\" id=\"c-prof\" name=\"c-prof\" placeholder=\"Type your comment on the professor here:\" maxlength=\"1000\"></textarea>";
?>
<p id="warning">Write comment within 1000 characters.</p>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-11 write">
<label for="c-proj">Comment on Project</label>
<?php
if($written!="false")
echo"<textarea class=\"form-control\" rows=\"8\" id=\"c-proj\" name=\"c-proj\">$cproj</textarea>";
else
echo"<textarea class=\"form-control\" rows=\"8\" id=\"c-proj\" name=\"c-proj\" placeholder=\"Type your comment on the project here:\" maxlength=\"1000\"></textarea>";
?>
<p id="warning">Write comment within 1000 characters.</p>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-11 write">
<label for="c-wl">Comment on Workload</label>
<?php
if($written!="false")
echo"<textarea class=\"form-control\" rows=\"8\" id=\"c-wl\" name=\"c-wl\">$cwl</textarea>";
else
echo"<textarea class=\"form-control\" rows=\"8\" id=\"c-wl\" name=\"c-wl\" placeholder=\"Type your comment on workload of this project here:\" maxlength=\"500\"></textarea>";
?>
<p id="warning">Write comment within 500 characters.</p>
</div>
</div>
</div>
<!--End of comment-->
<input type="submit" name="submit" value="Submit" class="btn btn-primary mrg" />
</form>
</div>
</div>
<a href="#home" id="toTop" class="scroll" style="display: block;">
<span id="toTopHover" style="opacity: 1;"></span>
</a>
<?php
include_once "footer.php"
?>