-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.php
81 lines (66 loc) · 2.27 KB
/
category.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
<?php
include 'admin/error.php';
session_start();
// Include database connection file
include_once('admin/controller/database/db.php');
if (!isset($_SESSION['ID'])) {
header("Location:index.php");
exit();
}
if(2==$_SESSION['ROLE']){
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Saustudy</title>
<?php include 'css.php'; ?>
</head>
<body>
<?php include 'menu.php'; ?>
<div class="container">
<div class="row mt-3">
<?php include 'slider.php'; ?>
</div>
<div class="row mt-3">
<?php
$id=$_POST['subject_id'];
// echo $id;
$sql="SELECT * FROM category WHERE subject_id='$id'";
$res = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="col-md-4 col-sm-12 ">
<div class="card viral-card m-1 text-center p-1">
<h4>
<?php echo $row["category"];
$category = $row["category_id"];
?>
</h4>
<form action="topics_list.php" method="POST">
<?php
$csql = "SELECT * FROM chapters WHERE category_id='$category'";
$cres = mysqli_query($conn, $csql);
while ($crow = mysqli_fetch_assoc($cres)) {
?>
<button class="btn viral-card-2 m-3" type="submit" name="chapter_id"
value="<?php echo $crow["chapter_id"]; ?>">
<?php echo $crow["chapter"]; ?>
</button>
<?php } ?>
</form>
</div>
</div>
<?php } ?>
</div>
</div>
<?php include 'footer.php'; ?>
<?php include 'js.php'; ?>
</body>
</html>
<?php }else{
session_destroy();
header("Location:index.php");
}
?>