-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathadmin.autorzy.edycja.php
51 lines (38 loc) · 1.08 KB
/
admin.autorzy.edycja.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
<?php
require_once 'vendor/autoload.php';
use Ibd\Autorzy;
if(empty($_GET['id'])) {
header("Location: admin.autorzy.lista.php");
exit();
} else {
$id = (int)$_GET['id'];
}
$autorzy = new Autorzy();
if(!empty($_POST)) {
if($autorzy->edytuj($_POST, $id)) {
header("Location: admin.autorzy.edycja.php?id=$id&msg=1");
exit();
}
}
include 'admin.header.php';
$dane = $autorzy->pobierz($id);
?>
<h2>
Autorzy
<small>edycja</small>
</h2>
<?php if(isset($_GET['msg']) && $_GET['msg'] == 1): ?>
<p class="alert alert-success">Autor został zapisany.</p>
<?php endif; ?>
<form method="post" action="" class="">
<div class="form-group">
<label for="imie">Imię</label>
<input type="text" id="imie" name="imie" class="form-control" value="<?=$dane['imie'] ?>" />
</div>
<div class="form-group">
<label for="nazwisko">Nazwisko</label>
<input type="text" id="nazwisko" name="nazwisko" class="form-control" value="<?=$dane['nazwisko'] ?>" />
</div>
<button type="submit" class="btn btn-primary">Zapisz</button>
</form>
<?php include 'admin.footer.php'; ?>