-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistaalunos.php
87 lines (70 loc) · 2.95 KB
/
listaalunos.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
<!DOCTYPE html>
<html lang="pt-br">
<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>listaalunos</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="lista.css">
</head>
<body>
</body>
</html>
<?php
/*
* Melhor prática usando Prepared Statements
*
*/
require_once('conexao.php');
$retorno = $conexao->prepare('SELECT * FROM aluno');
$retorno->execute();
?>
<div class="title">
<h1>Lista de alunos</h1>
</div>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>NOME</th>
<th>IDADE</th>
<th>DATA NASCIMENTO</th>
<th>ENDERECO</th>
<th>MATRICULA</th>
</tr>
</thead>
<tbody>
<tr>
<?php foreach ($retorno->fetchall() as $value) { ?>
<tr>
<td> <?php echo $value['id'] ?> </td>
<td> <?php echo $value['nomealuno'] ?> </td>
<td> <?php echo $value['idade'] ?> </td>
<td> <?php echo $value['nascimento'] ?> </td>
<td> <?php echo $value['ende'] ?> </td>
<td> <?php echo $value['matri'] ?> </td>
<td>
<form method="POST" action="altaluno.php">
<input name="id" type="hidden" value="<?php echo $value['id']; ?>" />
<button name="alterar" type="submit">Alterar</button>
</form>
</td>
<td>
<form method="GET" action="crudaluno.php">
<input name="id" type="hidden" value="<?php echo $value['id']; ?>" />
<button name="excluir" type="submit">Excluir</button>
</form>
</td>
</tr>
<?php } ?>
</tr>
</tbody>
</table>
<?php
echo "<button class='button button3'><a href='index.php'>voltar</a></button>";
?>
</div>
</php>