-
Notifications
You must be signed in to change notification settings - Fork 3
/
add-course.php
56 lines (52 loc) · 1.91 KB
/
add-course.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
<?php require_once('include/top.php');
if (!isset($_SESSION['username'])) {
header('Location: login.php');
}
elseif (isset($_SESSION['username']) && $_SESSION['role'] =='student'){
header('Location: home.php');
}
?>
<?php require_once('include/config.php'); ?>
<?php require_once('server.php'); ?>
<?php
if ($_GET['submit_course']) {
$sql = "INSERT INTO registration.courses (course_name) VALUES ('" . $_GET['course_name'] . "')";
if ($db->query($sql) === TRUE) {
//echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $db->error;
}
}
?>
</head>
<body>
<div id="wrapper">
<?php require_once('include/header.php'); ?>
<div class="container-fluid body-section">
<div class="row">
<div class="col-md-3">
<?php require_once('include/left-sidebar.php'); ?>
</div>
<div class="col-md-9">
<h1><i class="fa fa-book" aria-hidden="true"></i> Courses <small>Add new course</small></h1><hr>
<ol class="breadcrumb">
<li><a href="home.php"><i class="fa fa-tachometer"></i> Dashboard</a></li>
<li class="active"><i class="fa fa-folder-open"></i> Add New Course</li>
</ol>
<div class="row">
<div class="col-md-6">
<form action="">
<div class="form-group">
<label for="course">New Course Name:</label>
<input type="text" name="course_name" placeholder="Course Name" class="form-control">
</div>
<input type="submit" value="Add New Course" name="submit_course" class="btn btn-primary">
</form>
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
</div>
<?php require_once('include/footer.php'); ?>