-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaltaluno.php
100 lines (71 loc) · 2.89 KB
/
altaluno.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
<!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>alterar</title>
<link rel="stylesheet" href="altaluno.css">
</head>
<body>
<?php
require_once('conexao.php');
$id = $_POST['id'];
##sql para selecionar apens um aluno
$sql = "SELECT * FROM aluno where id= :id";
# junta o sql a conexao do banco
$retorno = $conexao->prepare($sql);
##diz o paramentro e o tipo do paramentros
$retorno->bindParam(':id', $id, PDO::PARAM_INT);
#executa a estrutura no banco
$retorno->execute();
#transforma o retorno em array
$array_retorno = $retorno->fetch();
##armazena retorno em variaveis
$nome = $array_retorno['nomealuno'];
$idade = $array_retorno['idade'];
$nascimento = $array_retorno['nascimento'];
$ende = $array_retorno['ende'];
$matri = $array_retorno['matri'];
?>
<H1>Altere as informações de cadastro</H1>
<form method="POST" action="crudaluno.php" >
<div class="input-group">
<div class="input-box">
<label for="">nome:</label>
<input type="text" name="nomealuno" id="" value=<?php echo $nome ?>>
</div>
<br>
<div class="input-box">
<label for="">idade:</label>
<input type="number" name="idade" id="" value=<?php echo $idade ?>>
</div>
<br>
<div class="input-box">
<label for="">id:</label>
<input type="number" name="id" id="" value=<?php echo $id ?>>
</div>
<br>
<div class="input-box">
<label for="">data nascimento:</label>
<input type="date" name="nascimento" id="" value=<?php echo $nascimento ?>>
</div>
<br>
<div class="input-box">
<label for="">endereco:</label>
<input type="text" name="ende" id="" value=<?php echo $ende ?>>
</div>
<br>
<div class="input-box">
<label for="">matricula:</label>
<input type="text" name="matri" id="" value=<?php echo $matri ?>>
</div>
<br>
<div class="ambos">
<input type="submit" name="update" value="Alterar">
<button class="button"><a href="listaalunos.php">voltar</a></button>
</div>
</div>
</form>
</body>
</html>