-
Notifications
You must be signed in to change notification settings - Fork 7
/
add-batch.php
364 lines (298 loc) · 10.7 KB
/
add-batch.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<?php
include_once('include/db-connect.php');
include_once("functions.php");
admin_logincheck();
$admin=$_SESSION['uname'];
$mobile=$_SESSION['mobile'];
if(isset($_POST['sub']) && $_POST['sub']=='Add')
{
$new_batch=mysql_real_escape_string(trim($_POST['batch']));
if($new_batch=="")
{
header('Location:index.php');
}
else
{
$db->setFetchMode(DB_FETCHMODE_ORDERED);
$sql_search='select * from batches where btname = ?';
$exe_search_query=& $db->query($sql_search, $new_batch);
$search_row=$exe_search_query->numRows();
if($search_row==1)
{
echo '<script> alert("Batch You Entered Is Already Existing") </script>';
}
else
{
$table_name='batches';
$fields_values=array(
'btname' =>$new_batch
);
$exe_query= $db->autoExecute($table_name, $fields_values, DB_AUTOQUERY_INSERT);
if($exe_query)
{
$id=mysql_insert_id();
$batch_id=array('btid' =>"BTID".$id);
$exe_query2= $db->autoExecute($table_name, $batch_id, DB_AUTOQUERY_UPDATE, "btno=$id");
}
if($exe_query2)
{
echo '<script> alert("Batch Added Successfully") </script>';
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<!-- Title and other stuffs -->
<title>College - Admin Panel</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<!-- Stylesheets -->
<link href="style/bootstrap.css" rel="stylesheet">
<!-- Font awesome icon -->
<link rel="stylesheet" href="style/font-awesome.css">
<!-- jQuery UI -->
<link rel="stylesheet" href="style/jquery-ui-1.9.2.custom.min.css">
<!-- Calendar -->
<link rel="stylesheet" href="style/fullcalendar.css">
<!-- prettyPhoto -->
<link rel="stylesheet" href="style/prettyPhoto.css">
<!-- Star rating -->
<link rel="stylesheet" href="style/rateit.css">
<!-- Date picker -->
<link rel="stylesheet" href="style/bootstrap-datetimepicker.min.css">
<!-- CLEditor -->
<link rel="stylesheet" href="style/jquery.cleditor.css">
<!-- Uniform -->
<link rel="stylesheet" href="style/uniform.default.html">
<!-- Uniform -->
<link rel="stylesheet" href="style/daterangepicker-bs3.css" />
<!-- Bootstrap toggle -->
<link rel="stylesheet" href="style/bootstrap-switch.css">
<!-- Main stylesheet -->
<link href="style/style.css" rel="stylesheet">
<!-- Widgets stylesheet -->
<link href="style/widgets.css" rel="stylesheet">
<!-- Gritter Notifications stylesheet -->
<link href="style/jquery.gritter.css" rel="stylesheet">
<!-- HTML5 Support for IE -->
<!--[if lt IE 9]>
<script src="js/html5shim.js"></script>
<![endif]-->
<script type="text/javascript">
function valid_details()
{
if(document.getElementById('batch').value=="")
{
alert("Please Enter Batch");
document.getElementById('batch').focus();
return false;
}
}
function delfile()
{
var yes=confirm("Are you sure want to delete this batch ?");
if(!yes)
{
return false;
}
else
{
window.location='batch_delete.php';
return true;
}
}
</script>
</head>
<body>
<header>
<div class="navbar navbar-fixed-top bs-docs-nav" role="banner">
<div class="container">
<!-- Menu button for smallar screens -->
<div class="navbar-header">
<button class="navbar-toggle btn-navbar" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse"><span>Menu</span></button>
<a href="#" class="pull-left menubutton hidden-xs"><i class="fa fa-bars"></i></a>
<!-- Site name for smallar screens -->
<a href="index.php" class="navbar-brand">Admin<span class="bold">Panel</span></a>
</div>
<!-- Navigation starts -->
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
<!-- Links -->
<ul class="nav navbar-nav pull-right">
<li class="dropdown pull-right user-data">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<?php echo $admin; ?><b class="caret"></b>
</a>
<!-- Dropdown menu -->
<ul class="dropdown-menu">
<li><a href="change-phone.php"><i class="fa fa-phone"></i>Change Phone</a></li>
<li><a href="change-pass.php"><i class="fa fa-cogs"></i>Change Password</a></li>
<li><a href="logout.php"><i class="fa fa-key"></i> Logout</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</header>
<!-- Main content starts -->
<div class="content">
<?php
include_once('header.php');
?>
<!-- Main bar -->
<div class="mainbar">
<!-- Page heading -->
<div class="page-head">
<h2 class="pull-left">Adding Batch</h2>
<div class="clearfix"></div>
<div class="clearfix"></div>
</div>
<!-- Page heading ends -->
<!-- Matter -->
<div class="matter">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="widget">
<div class="widget-head">
<div class="pull-left">Add Batch</div>
<div class="clearfix"></div>
</div>
<div class="widget-content">
<div class="padd">
<!-- Form starts. -->
<form class="form-horizontal" role="form" method="post" action="" onsubmit="return valid_details();">
<div class="form-group">
<label class="col-lg-4 control-label">Batch</label>
<div class="col-lg-8">
<input type="text" class="form-control" name="batch" id="batch" placeholder="Add Batch">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-6 col-lg-9">
<input type="submit" class="btn btn-info" name="sub" value="Add">
</div>
</div>
</form>
</div>
</div>
</div>
<div>
<div class="widget">
<div class="widget-head">
<div class="pull-left">Existing Batches</div>
<div class="clearfix"></div>
</div>
<div class="widget-content">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Sl.No</th>
<th>Batch</th>
<th>Control</th>
</tr>
</thead>
<?php
$db->setFetchMode(DB_FETCHMODE_ORDERED);
$sql_batches="select * from batches";
$exe_batches_query=& $db->query($sql_batches);
$batches=$exe_batches_query->numRows();
if($batches==0)
{
echo "<div class='alert alert-danger'>
Still Now No Batches Added
</div>";
}
else
{
echo "<tbody>";
$i=1;
while($ebatches=& $exe_batches_query->fetchRow())
{
echo "<tr>
<td>$i</td>
<td>$ebatches[2]</td>
<td>
<a href='batch_edit.php?Id=$ebatches[1]' title='Edit'><button class='btn btn-xs btn-warning'><i class='fa fa-pencil'></i></button></a>
<a href='batch_delete.php?Id=$ebatches[1]' onclick='return delfile();' title='Delete'><button class='btn btn-xs btn-danger'><i class='fa fa-times'></i></button></a>
</td>
</tr>";
$i++;
}
echo "</tbody>";
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Matter ends -->
</div>
<!-- Mainbar ends -->
<div class="clearfix"></div>
</div>
<!-- Content ends -->
<!-- Footer starts -->
<footer>
<div class="container">
<div class="row">
<div class="col-md-12">
<!-- Copyright info -->
<p class="copy">Copyright © 2014 | <a href="#">IT GEEK HUB</a> </p>
</div>
</div>
</div>
</footer>
<!-- Footer ends -->
<!-- Scroll to top -->
<span class="totop"><a href="#"><i class="fa fa-chevron-up"></i></a></span>
<!-- JS -->
<script src="js/jquery.js"></script> <!-- jQuery -->
<script src="js/bootstrap.js"></script> <!-- Bootstrap -->
<script src="js/jquery-ui-1.9.2.custom.min.js"></script> <!-- jQuery UI -->
<script src="js/fullcalendar.min.js"></script> <!-- Full Google Calendar - Calendar -->
<script src="js/jquery.rateit.min.js"></script> <!-- RateIt - Star rating -->
<script src="js/jquery.prettyPhoto.js"></script> <!-- prettyPhoto -->
<!-- Morris JS -->
<script src="js/raphael-min.js"></script>
<script src="js/morris.min.js"></script>
<!-- jQuery Flot -->
<script src="js/excanvas.min.js"></script>
<script src="js/jquery.flot.js"></script>
<script src="js/jquery.flot.resize.js"></script>
<script src="js/jquery.flot.pie.js"></script>
<script src="js/jquery.flot.stack.js"></script>
<!-- jQuery Notification - Noty -->
<script src="js/jquery.noty.js"></script> <!-- jQuery Notify -->
<script src="js/themes/default.js"></script> <!-- jQuery Notify -->
<script src="js/layouts/bottom.js"></script> <!-- jQuery Notify -->
<script src="js/layouts/topRight.js"></script> <!-- jQuery Notify -->
<script src="js/layouts/top.js"></script> <!-- jQuery Notify -->
<!-- jQuery Notification ends -->
<!-- Daterangepicker -->
<script src="js/moment.min.js"></script>
<script src="js/daterangepicker.js"></script>
<script src="js/sparklines.js"></script> <!-- Sparklines -->
<!-- <script src="js/jquery.gritter.min.js"></script> jQuery Gritter -->
<script src="js/jquery.cleditor.min.js"></script> <!-- CLEditor -->
<script src="js/bootstrap-datetimepicker.min.js"></script> <!-- Date picker -->
<script src="js/jquery.uniform.min.html"></script> <!-- jQuery Uniform -->
<script src="js/jquery.slimscroll.min.js"></script> <!-- jQuery SlimScroll -->
<script src="js/bootstrap-switch.min.js"></script> <!-- Bootstrap Toggle -->
<script src="js/filter.js"></script> <!-- Filter for support page -->
<script src="js/custom.js"></script> <!-- Custom codes -->
<script src="js/charts.js"></script> <!-- Charts & Graphs -->
<script src="js/index.js"></script> <!-- Index Javascripts -->
</body>
</html>