-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcourseRegistration.php
119 lines (102 loc) · 3.58 KB
/
courseRegistration.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
<?php
/**
* Created by PhpStorm.
* User: merah
* Date: 02-May-18
* Time: 12:49 AM
*/
session_start();
if (isset($_GET['logout'])) {
echo "entered here";
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Welcome Student <?php
echo $_SESSION['username'];
?></title>
<script src="universal_js.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">STUDENT</a>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="studentloggedIn.php">Courses</a></li>
<li class="active"><a href="#">Course Registration</a></li>
<li><a href="registrationRecord.php">Registration Record</a></li>
<li><a href="studentGrades.php">My Grades</a></li>
<li><a href="ticketStudent.php">Ticket</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="studentloggedIn.php?logout='1'" style="color: red;">Logout</a></li>
</ul>
</div>
</div>
</nav>
<!--<div class="container">-->
<!-- <button id="myButton" onclick="viewCourses()">View_Courses</button>-->
<!--</div>-->
<div class="container">
<h1>Courses offered this semester</h1>
<table class="table table-striped" id="table">
<caption class="title"></caption>
<thead>
<tr>
<th>#</th>
<th>Course Id</th>
<th>Name</th>
<th>Credits</th>
<th>Slot</th>
<th>LTP</th>
</tr>
</thead>
<tbody>
<?php
$username = $_SESSION['username'];
$db_connection = mysqli_connect('localhost', 'root', '', 'university_database');
// Check The Connection
if (!$db_connection) {
die("Connection Failed: " . mysqli_connect_error());
}
mysqli_select_db($db_connection, "crp");
$sql1 = 'SELECT course_offering.id,title,credits,slot,ltp FROM course_offering INNER JOIN courses ON courses.id=course_offering.id ;';
$result = mysqli_query($db_connection, $sql1);
$no = 1;
$total = 0;
while ($row = mysqli_fetch_row($result)) {
$variable = '' . $row[0];
echo '<tr id=' . $no . '>
<td>' . $no . '</td>
<td>' . $row[0] . '</td>
<td>' . $row[1] . '</td>
<td>' . $row[2] . '</td>
<td>' . $row[3] . '</td>
<td>' . $row[4] . '</td>
<td><button class="btn btn-primary" id = ' . $no . ' onclick="addCourse(this)">Add</button></td>
</tr>';
$no++;
} ?>
</tbody>
</table>
</div>
</body>
</html>