erste push

This commit is contained in:
2024-08-30 21:45:00 +02:00
parent 7567326efd
commit 10f115ddd4
8 changed files with 509 additions and 0 deletions

62
index.php Normal file
View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tiere in unserem Kleingarten</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css">
<style>
.btn {margin-top: 7px;}
</style>
</head>
<body>
<div class="container">
<h1 class="page-header text-center">Tiere in unserem Kleingarten</h1>
<div class="row">
<div class="col-12">
<a href="add.php" class="btn btn-primary">Hinzufügen</a>
<!-- Button zum Wiederherstellen der JSON-Datei -->
<a href="recover.php" class="btn btn-danger">JSON wiederherstellen</a>
<table class="table table-bordered table-striped" style="margin-top:20px;">
<thead>
<th>ID</th>
<th>Name</th>
<th>Wissenschaftlicher Name</th>
<th>Beschreibung</th>
<th>Lebensraum</th>
<th>Nahrung</th>
</thead>
<tbody>
<?php
// JSON-Daten holen
$data = file_get_contents('tiere.json');
//Decode in php Array
$data = json_decode($data);
$index = 0;
foreach($data as $row){
echo "
<tr>
<td>".$row->id."</td>
<td>".$row->name."</td>
<td>".$row->wissenschaftlicher_name."</td>
<td>".$row->beschreibung."</td>
<td>".$row->lebensraum."</td>
<td>".$row->nahrung."</td>
<td>
<a href='edit.php?index=".$index."' class='btn btn-success btn-sm'>Bearbeiten</a>
<a href='delete.php?index=".$index."' class='btn btn-danger btn-sm'>Löschen</a>
</td>
</tr>
";
$index++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>