Repository navigation
Expand file tree
/
Copy pathaddClass.php
More file actions
90 lines (87 loc) · 4.51 KB
/
Copy pathaddClass.php
File metadata and controls
90 lines (87 loc) · 4.51 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
<?php
include('utils/session.php');
if (!isset($_SESSION['login_user'])) {
header("location: index.php"); // Redirecting To Home Page
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- MDBootstrap CDN Start -->
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<!-- Bootstrap core CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.8.2/css/mdb.min.css" rel="stylesheet">
<!-- JQuery -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.4/umd/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.8.2/js/mdb.min.js"></script>
<!-- MDBootstrap CDN END -->
<title>Classes</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<?php
require_once("classesDataClass.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$classesDataClass = new classesData();
$classesDataClass->Insert($_POST["className"], $_POST['classNumericName'], $_POST['teacher'], $_POST['section']);
}
?>
</head>
<body>
<?php
include('utils/header.php');
require_once("utils/config.php");
$connection = mysqli_connect(DBHOST, DBUSER, DBPASSWORD, DBNAME);
if (mysqli_connect_error()) {
die(mysqli_connect_error());
} else { }
?>
<div class="d-flex" id="wrapper">
<?php include("utils/sidebar.php") ?>
<div id="main-content">
<form action="" method="post">
<div class="form-group">
<label for="className">Class Name</label>
<input type="text" name="className" class="form-control" id="className" placeholder="One">
</div>
<div class="form-group">
<label for="classNumericName">Class Numeric Name</label>
<input type="text" name="classNumericName" class="form-control" id="classNumericName" placeholder="1">
</div>
<div class="form-group">
<label for="section">Section</label>
<input type="text" name="section" class="form-control" id="section" placeholder="A">
</div>
<div class="form-group">
<label for="teacher">Teacher</label>
<select name="teacher">
<?php
$sql = "SELECT teacherId, FirstName, LastName FROM teacher";
$result = mysqli_query($connection, $sql);
$select = "";
while ($row = mysqli_fetch_assoc($result)) {
// $teacherData = array("teacherId" => $row["teacherId"], "FirstName" => $row['FirstName'], "LastName" => $row['LastName']);
$select .= '<option value="' . $row['teacherId'] . '"> ' . $row['FirstName'] . ' ' . $row['LastName'] . '</option>';
}
echo $select;
?>
</select>
<!-- <input type="text" name="teacher" class="form-control" id="teacher" placeholder="Leave it null for now"> -->
</div>
<button type="submit" class="btn btn-primary">Add</button>
</form>
</div>
</div>
</body>
</html>