<?php

include ("baglan.php");

if (isset($_POST["yaziguncelle"])) {

$baslik = $_POST["baslik"];
$yazi = $_POST["yazi"];
$id = $_POST["id"];

$sorgu= $baglan->prepare('update tablo set baslik=?, yazi=? where id=?');
$sorgu->execute(array($baslik,$yazi,$id));

if($sorgu) {
    echo "Güncellendi";
    header("refresh:2;index.php");
    } else {
    echo "Güncellenemedi!";
    header("refresh:2;index.php");
    }

}
else {
echo '<form action="" method="post">
<input type="text" name="baslik"><br>
<input type="text" name="yazi"><br>
<input type="text" name="id"><br>
<input name="yaziguncelle" type="submit" value="Güncelle">
</form>';
    }

?>