-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.php
More file actions
64 lines (52 loc) · 1.73 KB
/
Copy pathdisplay.php
File metadata and controls
64 lines (52 loc) · 1.73 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
<?php
session_start();
if (!isset($_SESSION['students'])) {
$_SESSION['students'] = array();
}
if (isset($_POST['student'])) {
# code...
$new_student = $_POST['student'];
array_push($_SESSION['students'], $new_student);
}
$defaultFontSize = isset($_COOKIE['fontSize']) ? $_COOKIE['fontSize'] : "16";
$defaultFontWeight = isset($_COOKIE['fontWeight']) ? $_COOKIE['fontWeight'] : "normal";
$defaultShowIpk = isset($_COOKIE['showIpk']) ? $_COOKIE['showIpk'] : "";
$defaultShowAlamat = isset($_COOKIE['showAlamat']) ? $_COOKIE['showAlamat'] : "";
?>
<!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>Display</title>
<style>
.item {
font-size: <?php echo $defaultFontSize ?>px;
font-style: <?php echo $defaultFontWeight ?>;
}
.show-ipk {
display: <?php if ($defaultShowIpk == 'Tidak') echo 'none' ?>;
}
.show-alamat {
display: <?php if ($defaultShowAlamat == 'Tidak') echo 'none' ?>;
}
</style>
</head>
<body>
<h1>Display</h1>
<?php
if (isset($_SESSION['students'])) {
echo "<h3>Session data for all students:</h3>";
foreach ($_SESSION['students'] as $key => $student) {
echo $key + 1 . '.';
echo "<p class='item'>NRP : " . $student[0] . "</p>";
echo "<p class='item'>Nama : " . $student[1] . "</p>";
echo "<p class='item show-alamat'>Adress : " . $student[2] . "</p>";
echo "<p class='item show-ipk'>IPK : " . $student[3] . "</p>";
echo "<br>";
}
}
?>
</body>
</html>