-
Notifications
You must be signed in to change notification settings - Fork 1
/
complaint.php
55 lines (48 loc) · 1.13 KB
/
complaint.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include ("header.php");
session_start();
$user = $_GET['un'];
$stdid=$_GET['sid'];
$hostelid=$_GET['hid'];
$user1=$_SESSION['username'];
if ($user1 == true)
{
}
else{
header("location:index.php");
}
?>
<form method="post">
<div>
<h1>COMPLAINTS</h1>
<label for="rmno">ENTER ROOM NO :</label><br>
<input type="text" id="rmno" name="rmno">
</div>
<div>
<label for="comment"> ANY OTHER COMPLAINT:</label>
<textarea class="form-control" rows="10" cols="50" id="query" name="text"></textarea>
<input type="submit" value="Submit" name="submit" class="btn btn-primary">
</div>
</form>
<?php
if(isset($_POST['submit'])){
$user = $_GET['un'];
$stdid=$_GET['sid'];
$hostelid=$_GET['hid'];
$rmnumber=$_POST['rmno'];
$text=$_POST['text'];
if($rmnumber!="" && $text!="")
{
$query="INSERT INTO `complaint`(`hostelid`, `stdid`, `name`, `text`) VALUES ('".$hostelid."','".$stdid."','$rmnumber','$text')";
$data=mysqli_query($conn,$query);
if($data)
{
echo "Data inserted successfully.";
}
else
{
echo "Error inserting student";
}
}
}
?>