-
Notifications
You must be signed in to change notification settings - Fork 0
/
guncelle.php
44 lines (36 loc) · 1.58 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
<?php
include("include/adminheader.php");
include("ayar.php");
include("fonksiyon.php");
if(isset($_POST["submit"])){ //Sayfa post edilmişse
$id = $_POST["id"];
$baslik = $_POST["baslik"];
$icerik = $_POST["icerik"];
makaleGuncelle($id, $baslik, $icerik); //makaleyi güncelle
header("location: admin.php");
}
if($_GET["id"] != null){ //güncellenecek makaleyi getir
$id = $_GET["id"];
$komut = $db->prepare("SELECT * FROM makale WHERE MakaleID = ?");
$komut->execute(array($id));
$sonuc = $komut->fetch(PDO::FETCH_ASSOC);
if ($komut->rowCount()) {
print "<form action = 'guncelle.php' method = 'POST'>";
print "<div class='form-group'>";
print "<input type = 'hidden' name = 'id' value ='".$sonuc["MakaleID"]."' />";
print "Başlık";
print "<input class='form-control' type = 'text' name = 'baslik' value ='".$sonuc["MakaleBaslik"]."' /><br />";
print "Makale";
print "<textarea class ='ckeditor' name = 'icerik' cols = '70' rows = '10'>".$sonuc["MakaleIcerik"]."</textarea><br />";
print "<button class='btn btn-primary' type = 'submit' name = 'submit'>Makale Güncelle</button>";
print "</div>";
}
}
else{
header("location: admin.php");
}
?>
</div><!--container-->
<script src="ckeditor/ckeditor.js"> </script>
</body>
</html>