-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
128 lines (102 loc) · 5.12 KB
/
index.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
120
121
122
123
124
125
126
127
128
<?php
session_start();
?>
<!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, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Poli & Dokter</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
</head>
<body class="sb-nav-fixed">
<!-- Navbar -->
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
<!-- Navbar Brand-->
<h4 class="ps-3 pe-3 text-white"><i class="bi bi-vr"></i> Poli & Dokter</h4>
</nav>
<!-- </Akhir navbar -->
<!-- Main content -->
<div id="Maincontent">
<main>
<div class="container">
<div class="row mt-5">
<div class="col mt-5">
<!-- Form -->
<form id="form_id" action="list_pasien.php" method="post">
<div class="card mb-4 border-success">
<div class="card-body bg-success text-white">Pemilihan Poli & Dokter</div>
<div class="card-footer align-items-center justify-content-between bg-white">
<!-- Pilih poli -->
<div class="mb-3">
<label for="no_poli" class="form-label ms-3 mt-2 text-uppercase fs-5">Nama Poliklinik :</label>
<select class="form-control w-75 float-end me-5 mt-2" name="no_poli" id="no_poli">
<?php $_SESSION['no_poli'] = 'no_poli'; ?>
<option value="">--Pilih Poli--</option>
<option value="1">poli kandungan</option>
<option value="2">poli umum</option>
<option value="3">poli gigi</option>
</select>
</div>
<!-- </Akhir pilih poli -->
<!-- Pilih pilih dokter -->
<div class="mb-3 mt-5">
<label for="nm_dokter" class="form-label ms-3 mt-2 text-uppercase fs-5">Nama Dokter :</label>
<select name="nm_dokter" class="form-control w-75 float-end me-5 mt-2" id="dokter" required>
<option value="">--Pilih Dokter--</option>
<!-- Hasil nama dokter akan di tampilkan di sini menggunakan AJAX -->
</select>
</div>
<!-- </Akhir pilih dokter -->
</div>
<!-- Button load -->
<div style="text-align: right;">
<button type="submit" class="btn btn-warning mt-3 mb-3 me-5 fw-bold text-white">LOAD</button>
</div>
<!-- </Akhir button load -->
</div>
</form>
<!-- </Akhir form -->
</div>
</div>
</div>
</main>
</div>
<!-- </Akhir main content -->
<!-- Jquery bs 5 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<!-- jquery 3.6.3 -->
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
<!-- Script jquery -->
<script>
// ketika dokumen sudah di load
$(document).ready(function() {
// dan ketika pemilihan poli tertentu
$("#no_poli").change(function() {
// ambil no poli
let no_poli = $(this).val();
// lakukan AJAX
$.ajax({
// GET data
type: "GET",
// pada file ambil_dokter.php
url: "ambil_dokter.php",
// data yang di ambil
data: {
no_poli: no_poli,
},
// ketika sukses
success: function(result) {
// tampilkan ke select name nm_dokter
$("select[name='nm_dokter']").html(result);
}
});
});
});
</script>
</body>
</html>