Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions views/pages/institution/controller/update-school-controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
header('Location: /here/views/pages/institution/school/list-school.page.php');
include_once ('/xampp/htdocs' . '/here/database/connection.php');

$connection = Connection::connection();


if (isset($_POST['update'])) {

$id = $_GET['updateIdSchool'];
$name = $_POST['updateNameSchool'];

$stmt = $connection->prepare("UPDATE schools
SET nameSchool = ?
WHERE idSchool = $id");
$stmt->bindValue(1, $name);
$stmt->execute();
}
43 changes: 43 additions & 0 deletions views/pages/institution/school/forms-update-school-page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
include_once('/xampp/htdocs' . '/here/database/connection.php');

$connection = Connection::connection();
// Se EXISTIR a ID vinda pelo método GET, ele fará o bloco de comando proposto.
if (isset($_GET['updateSchool'])) {

$id = $_GET['updateSchool'];

$stmt = $connection->prepare("SELECT * FROM schools
WHERE idSchool = $id
");
$stmt->execute();
$rowCat = $stmt->fetch(PDO::FETCH_BOTH);
}
?>

<!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>Cadastro ETEC | HERE!</title>
</head>

<body>
<form action="../controller/update-school-controller.php?updateIdSchool=<?php echo $rowCat[0]?>" name="forms-update-school-page" method="post">
<label>Editar nome da ETEC</label>
<br />
<br />
<label>Nome ETEC</label>
<br />
<input type="text" name="updateNameSchool" value="<?php echo $rowCat[1] ?>" />
<br />

<br />
<input type="submit" value="Atualizar" name="update">
</form>
</body>

</html>
4 changes: 3 additions & 1 deletion views/pages/institution/school/list-school.page.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
</div>
</div>
</a>

</div>
<!-- fim card cadastro unitário -->

Expand Down Expand Up @@ -141,7 +142,7 @@
<td class="td col-2">
<div class="divo">
<div class="botao-edit butao">
<a href="#">
<a href="./forms-update-school-page.php?updateSchool=<?php echo $row[0]; ?>">
<img src="../../../images/lapis.svg" class="trash">
</a>
</div>
Expand All @@ -166,3 +167,4 @@

</html>