-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddcompl.php
220 lines (152 loc) · 5.71 KB
/
addcompl.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
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
<?php
include('session.php');
include('header.php');
include('dbconnect.php');
?>
<div class="container-fluid">
<?php include('menubar.php')?>
<?php // include('menubar1.php');
//$trans_id= uniqid();
$trans_id=uniqid();
?>
<div class="container-fluid">
<div class="col-md-2"></div>
<div class="col-md-8">
<ul class="list-group" id="myinfo" >
<li class="list-group-item" id="mylist"></li>
</ul>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Complainant Details</h3>
</div>
<div class="panel-body">
<div class="container-fluid">
<form class="form-horizontal" id="addcase" role="form">
<div class="form-row">
<div class="col-md-6">
<div class="form-group">
<label for="">Name of Complainant:</label>
<input type="hidden" name="uid" value="<?php echo $trans_id?>">
<input type="text" name="name" class="form-control" id="name" placeholder="Enter Name"
autofocus="" >
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="">Tel Phone:</label>
<input type="text" name="tel" class="form-control" id="tel" maxlength="10" placeholder="Enter Number" >
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6">
<div class="form-group">
<label for="">Occupation:</label>
<input type="text" name="occ" class="form-control" id="nid" placeholder="Enter Occupation"
autofocus="" >
</div>
<div class="col-md-6">
<div class="form-group">
<label for="">Gender:</label>
<select class="form-control" name="gender" id ="idcrime">
<option selected="selected" value="">Select</option>
<option value="Male"> Male</option>
<option value="Female"> Female</option>
</select>
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6">
<div class="form-group">
<label for="">Age:</label>
<input type="number" name="age" class="form-control" id="addrs" placeholder="Age" >
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="">Address:</label>
<input type="text" name="addrs" class="form-control py-4" id="digaddrs" placeholder="Address" >
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6">
<div class="form-group">
<label for="">Region:</label>
<script type="text/javascript" src="js/regions.js"></script>
<select class="form-control" required="" onchange="print_state('state',this.selectedIndex);" id="country" name ="region">
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="">District/Municipal:</label>
<select required="" class="form-control" name ="district" id ="state"></select>
<script language="javascript">print_country("country");</script>
</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6">
<div class="form-group">
<label for="">Location:</label>
<input type="text" name="loc" class="form-control" id="loc" placeholder="Enter Location" >
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="">Select Crime Type:</label>
<select class="form-control" name="crime_type" id ="crime">
<option selected="selected" value="">Select</option>
<?php
//Get all unions from database
$sql = mysqli_query($dbcon,"select * from crime_type");
while($row = mysqli_fetch_assoc($sql)){ ?>
<option value="<?php echo $row['des'] ?>"> <?php echo $row['des']?> </option>
<?php
}
?> </select>
</div>
</div>
</div>
<div class="form-group">
<button type="submit" name="save_case" class="btn btn-success form-control">Save and Continue
<span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
<?php include('scripts.php'); ?>
<script type="text/javascript">
$(document).on('submit', '#addcase', function(event) {
event.preventDefault();
// This removes the error messages from the page
$(".list-group-item").remove();
var formData = $(this).serialize();
$.ajax({
url: 'savecompl.php',
type: 'post',
data: formData,
dataType: 'JSON',
success: function(response){
if(response.error){
var len = response[0].length;
for(var i=0; i<len; i++){
$('#myinfo').append('<li class="list-group-item alert alert-danger"> ' + response[0][i] + '</li>');
}
}
else{
window.location=response.url;
}
}
});
});
</script>
</body>
</html>