-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
89 lines (63 loc) · 2.26 KB
/
index.php
File metadata and controls
89 lines (63 loc) · 2.26 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
<?php
require_once "config.php";
require_once "database.php";
$db = connect(DB_SERVER,USER,PASSWORD,DB_NAME);
?>
<!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.0" />
<title>Student Dashboard</title>
<link
rel="stylesheet"
href="./bootstrap-5.1.3-dist/css/bootstrap.min.css"
/>
<link rel="stylesheet" href="./style.css" />
<link rel="stylesheet" href="./fontawesome-free-6.0.0-web/css/all.css" />
</head>
<body>
<form action="units.php" method="post">
<div class="container">
<h1>Units</h1>
<hr>
<?php
//todos
//when button at reg sem is selected, Display all units for that sem
//insert into student_stage
session_start();
$reg_sem = $_POST['registered_sem'];
$student_adm = $_SESSION['adm_number'];
$student_id = select_studentId($db,$student_adm);
$year = $_POST['radio'][0];
$sem = $_POST['radio'][1];
$stage_id = select_stage_id($db,$year,$sem);
if(isset($reg_sem)){
if(!empty($_POST['radio'])) {
foreach($stage_id as $id){
// echo $id['ID'];
// var_dump($id);
$sql = "SELECT `code`,`name` FROM stage_course join units on `code` = `unit_code` where stage_id =". $id['ID'];
foreach($student_id as $std_id){
insert_into_student_sem($db,$std_id['ID'],$id['ID']);
}
}
$resultset = $db->query($sql);
while ($row = $resultset->fetch_assoc()) {
echo "<input type = 'checkbox' name = 'units[]' value = '".$row['code']." ".$row['name']."'/> ".$row['code']." ".$row['name'] .'<br>';
}
}else{
echo "No semester selected";
}
echo "<input type = 'submit' class='btn btn-primary' name = 'registered'/>";
}
//todo
//insert into student sem
?>
</div>
</form>
<script src="./bootstrap-5.1.3-dist/js/bootstrap.min.js">
</script>
</body>
</html>