-
Notifications
You must be signed in to change notification settings - Fork 0
/
guncelle.php
61 lines (51 loc) 路 1.85 KB
/
guncelle.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
<?php
require_once 'config.php';
$database = new PDO(DB_TYPE . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
if ($_SERVER["REQUEST_METHOD"] == "GET") {
$gid = $_GET["id"];
if ($database) {
$stmt = $database->prepare("SELECT * FROM yapilacak_listesi WHERE id = :id");
$stmt->bindParam(':id', $gid);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$kayit = $stmt->fetch(PDO::FETCH_ASSOC);
}
}
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$gid = $_GET["id"];
$gbaslik = $_POST["fbaslik"];
$gdetay = $_POST["fdetay"];
$stmt = $database->prepare("UPDATE yapilacak_listesi SET baslik = :baslik, detay = :detay WHERE id = :id");
$stmt->bindParam(':id', $gid);
$stmt->bindParam(':baslik', $gbaslik);
$stmt->bindParam(':detay', $gdetay);
if ($stmt->execute()) {
echo "G眉ncellendi<br />";
header("Location: goruntule.php");
exit();
} else {
echo "Hata";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Yap谋lacak Listesi</title>
<link href="https://fonts.googleapis.com/css?family=Ubuntu:400,500,700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/custom.css">
</head>
<body>
<div class="tema mini-modal">
<div class="hero">
<h2>G眉ncelle</h2>
</div>
<form action='guncelle.php?id=<?php echo $gid;?>' method='post'>
<input type='text' name='fbaslik' value='<?php echo isset($kayit["baslik"]) ? htmlspecialchars($kayit["baslik"]) : ''; ?>'>
<input type='text' name='fdetay' value='<?php echo isset($kayit["detay"]) ? htmlspecialchars($kayit["detay"]) : ''; ?>'>
<button class="buton" type='submit'>g眉ncelle</button>
</form>
</div>
</body>
</html>