-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
78 lines (78 loc) · 2.42 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
<?php date_default_timezone_set("America/Argentina/Buenos_Aires");
require 'pdo.php';
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<title>Bitácora AJAX</title>
</head>
<body>
<div class="container">
<div class="row">
<h1>Bitácora AJAX</h1>
<div class="col-sm-12 col-md-6">
<div class="list-group">
<?php
$stmt = $pdo -> prepare("SELECT * FROM bitacora ORDER BY id DESC LIMIT 20");
$stmt -> execute();
while ($row = $stmt -> fetch()) : ?>
<a href="delete.php?id=<?php echo $row['id'] ?>" class="list-group-item list-group-item-action d-flex">
<div class="d-flex gap-2 py-1 w-100 justify-content-between">
<div>
<small class="opacity-50"><?php echo $row['fecha'] ?></small>
<h6 class="mb-0"><?php echo $row['titulo'] ?></h6>
<p class="mb-0 opacity-75"><?php echo $row['texto'] ?></p>
</div>
</div>
</a>
<?php endwhile; ?>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="position-sticky">
<form
class="needs-validation"
action="create.php"
method="POST"
novalidate>
<div class="mb-3">
<label for="titulo" class="form-label">Título</label>
<input
name="titulo"
type="text"
class="form-control"
required>
<div class="invalid-feedback">
Debe tener un título.
</div>
</div>
<div class="mb-3">
<label for="texto" class="form-label">Texto</label>
<textarea
name="texto"
type="text"
class="form-control"
rows="8"
required></textarea>
<div class="invalid-feedback">
Debe contener texto.
</div>
</div>
<div class="mb-3">
<input
type="submit"
class="btn btn-dark"
value="Agregar">
</div>
</form>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
</body>
</html>