PHP Veri güncelleme olayı nasıl yapılır?

DevianFy!

Hectopat
Katılım
4 Temmuz 2020
Mesajlar
4
Kolay gelsin güncelle linkine basınca tablodaki ve MySQL'deki veriyi nasıl güncellerim kaydet ve Şili yaptım.

form.PNG


Kodlar alta.
form1.php
<?PHP
include("baglanti1.php");
$Sonuç=$db->query("select * from admin")->fetchall(pdo: Fetch_assoc);
<Form action="indexx.php" method="post">
<İnput type="text" name="adsoyad" >
<İnput type="text" name="mail" >
<İnput type="text" name="sifre" >
<Button type="submit" name="kaydet">kaydet</button>

</Form>
<Table border="1" width="500">
<Thead>
<Tr>
<Th>ad soyad</th>
<Th>mail</th>
<Th>sifre</th>

</Tr>
</Thead>
<Tbody>
<?PHP foreach($sonuç as $key=> $value) {?>
<Tr>
<Th><?PHP echo $value["adSoyad"]?></th>
<Th><?PHP echo $value["mail"]?></th>
<Th><?PHP echo $value["sifre"]?></th>
<Td><a href="indexx.php?silid=<?PHP echo $value['id']?>">sil</a></td>
<Td><a href="indexx.php?guncelleid=<?PHP echo $value['id']?>">guncelle</a></td>
</Tr>
<?PHP
}?>
</Tbody>
</Table>

indexx.php
<?PHP
include("baglanti1.php");
İf(isset($_post["kaydet"]))
{
$Adsoyad=$_post["adSoyad"];
$Mail=$_post["mail"];
$Sifre=$_post["sifre"];
$Sorgu=$db->prepare("ınsert ınto admin(adsoyad, mail, sifre)values(?)");
$Sorgu->bindvalue(1,$adsoyad);
$Sorgu->bindvalue(2,$mail);
$Sorgu->bindvalue(3,$sifre);
$sorgu->execute();
}
İf(isset($_get["silid"])) {
$Silid = $_get["silid"];
$Sorgu = $db->prepare("delete from admin where ID = $silid");
$sorgu->execute();
}
Header("location: form1.php");
 
Son düzenleyen: Moderatör:

Geri
Yukarı