-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-class-to-stream.php
209 lines (169 loc) · 9.78 KB
/
add-class-to-stream.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
<?php
session_start();
error_reporting(0);
include('includes/config.php');
include('includes/db.php');
include('includes/functions.php');
if (strlen($_SESSION['alogin']) == "") {
redirect_To("index.php");
} else {
if (isset($_POST['submit'])) {
global $con;
$class = $_POST['class'];
$stream = $_POST['stream'];
$sql = "INSERT INTO `class_stream`(`class_id`, `stream_id`, `created_at`)
VALUES ($class, $stream, CURRENT_TIMESTAMP())";
$execute = mysqli_query($con, $sql);
if ($execute) {
$msg = "Class Added To Stream.";
} else {
$error = mysqli_error($con);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SRMS Add Subject to Class</title>
<link rel="stylesheet" href="css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="css/font-awesome.min.css" media="screen">
<link rel="stylesheet" href="css/animate-css/animate.min.css" media="screen">
<link rel="stylesheet" href="css/lobipanel/lobipanel.min.css" media="screen">
<link rel="stylesheet" href="css/prism/prism.css" media="screen">
<link rel="stylesheet" href="css/select2/select2.min.css">
<link rel="stylesheet" href="css/main.css" media="screen">
<script src="js/modernizr/modernizr.min.js"></script>
</head>
<body class="top-navbar-fixed">
<div class="main-wrapper">
<!-- ========== TOP NAVBAR ========== -->
<?php include('includes/topbar.php'); ?>
<!-- ========== WRAPPER FOR BOTH SIDEBARS & MAIN CONTENT ========== -->
<div class="content-wrapper">
<div class="content-container">
<!-- ========== LEFT SIDEBAR ========== -->
<?php include('includes/leftbar.php'); ?>
<!-- /.left-sidebar -->
<div class="main-page">
<div class="container-fluid">
<div class="row page-title-div">
<div class="col-md-6">
<h2 class="title">Add Subject To Class</h2>
</div>
<!-- /.col-md-6 text-right -->
</div>
<!-- /.row -->
<div class="row breadcrumb-div">
<div class="col-md-6">
<ul class="breadcrumb">
<li><a href="dashboard.php"><i class="fa fa-home"></i> Home</a></li>
<li> <a href="manage-subjects.php"> Stream</a></li>
<li class="active">Add Class Subject Combination</li>
</ul>
</div>
</div>
<!-- /.row -->
</div>
<br>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-heading">
<div class="panel-title">
<h5>Add Subject To Class</h5>
</div>
</div>
<div class="panel-body">
<?php if ($msg) { ?>
<div class="alert alert-success left-icon-alert" role="alert">
<strong>Success!</strong><?php echo htmlentities($msg); ?>
</div><?php } else if ($error) { ?>
<div class="alert alert-danger left-icon-alert" role="alert">
<strong>Oh snap!</strong> <?php echo htmlentities($error); ?>
</div>
<?php } ?>
<form class="form-horizontal" method="post">
<div class="form-group">
<label for="default" class="col-sm-2 control-label">Stream</label>
<div class="col-sm-10">
<select name="stream" class="form-control" id="default" required="required">
<option value="">Select Stream</option>
<?php
$sql = "SELECT * from stream";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
if ($query->rowCount() > 0) {
foreach ($results as $result) { ?>
<option value="<?php echo htmlentities($result->id); ?>">
<?php echo htmlentities($result->name); ?></option>
<?php }
} ?>
</select>
</div>
</div>
<div class="form-group">
<label for="default" class="col-sm-2 control-label">Class</label>
<div class="col-sm-10">
<select name="class" class="form-control" id="default" required="required">
<option value="">Select Class</option>
<?php
$sql = "SELECT * from tblclasses";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
if ($query->rowCount() > 0) {
foreach ($results as $result) { ?>
<option value="<?php echo htmlentities($result->id); ?>"><?php echo htmlentities($result->ClassName); ?> Section-<?php echo htmlentities($result->Section); ?></option>
<?php }
} ?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" name="submit" class="btn btn-primary">Add</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- /.col-md-12 -->
</div>
</div>
</div>
<!-- /.content-container -->
</div>
<!-- /.content-wrapper -->
</div>
<!-- /.main-wrapper -->
<script src="js/jquery/jquery-2.2.4.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script>
<script src="js/pace/pace.min.js"></script>
<script src="js/lobipanel/lobipanel.min.js"></script>
<script src="js/iscroll/iscroll.js"></script>
<script src="js/prism/prism.js"></script>
<script src="js/select2/select2.min.js"></script>
<script src="js/main.js"></script>
<script>
$(function($) {
$(".js-states").select2();
$(".js-states-limit").select2({
maximumSelectionLength: 2
});
$(".js-states-hide").select2({
minimumResultsForSearch: Infinity
});
});
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
</body>
</html>
<?php } ?>