This commit is contained in:
james 2024-10-22 15:14:07 +02:00
parent 7bb2265517
commit 01b6de5e6f
2 changed files with 2 additions and 34 deletions

View File

@ -1,16 +0,0 @@
<?php
$conn = new mysqli("localhost", "root", "", "szkola");
$sql = "SELECT id, role_name FROM roles";
$result = $conn->query($sql);
$roles = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$roles[] = $row;
}
}
header('Content-Type: application/json');
echo json_encode($roles);
$conn->close();
?>

View File

@ -20,24 +20,6 @@
} }
</style> </style>
<script> <script>
function fetchRoles() {
fetch('get1.php')
.then(response => response.json())
.then(data => {
const select = document.getElementById('select-role');
data.forEach(role => {
const option = document.createElement('option');
option.value = role.id;
option.textContent = role.role_name;
select.appendChild(option);
console.log(option);
});
})
}
document.addEventListener('DOMContentLoaded', (event) => {
fetchRoles();
});
function fetchClasses() { function fetchClasses() {
fetch('get2.php') fetch('get2.php')
.then(response => response.json()) .then(response => response.json())
@ -214,6 +196,8 @@
<div class="footer-left"> <div class="footer-left">
<p>B. Hrynowiecki</p> <p>B. Hrynowiecki</p>
<p>K. Michalak</p> <p>K. Michalak</p>
<p>J. Kukiela</p>
<p>A. Guzik</p>
<p>F. Kowalski</p> <p>F. Kowalski</p>
<p>S. Ptak</p> <p>S. Ptak</p>
<p>B. Bohdan</p> <p>B. Bohdan</p>