Witam mam problem zrobiłem skrypt zapisujący dane z formularza do bazy danych i chcę teraz dodać że po kliknięciu przycisku się to usunie ale coś mi nie działa
Index.php
<?php
$con=mysqli_connect("xx","xx","xx","xx");
// Check connection
if (mysqli_connect_errno()) {
echo "Błąd podczas łączenia z bazą danych: " . mysqli_connect_error
(); }
$result = mysqli_query($con,"SELECT * FROM Lokalizacja");
echo "<table border='1' width='100%'> <tr>
<th><form action=insert.php method=post></th>
<th>Nick: <input type=text name=Nick maxlength=20 size=20></th>
<th>Panstwo: <input type=text name=Panstwo maxlength=20 size=20></th>
<th>Miasto: <input type=text name=Miasto maxlength=20 size=20><input type=submit></form></th>
</tr>
<tr>
<th>ID</th>
<th>Nick</th>
<th>Panstwo</th>
<th>Miasto</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<td width='5%'>" . $row['ID'] . "</td>"; echo "<td width='30%'>" . $row['Nick'] . "</td>"; echo "<td width='30%'>" . $row['Panstwo'] . "</td>"; echo "<td width='30%'>" . $row['Miasto'] . "</td>"; echo "<td width='5%'><form action=delete.php><input type=button value=Usun></form></td>"; }
mysqli_close($con);
?>
insert.php
<?php
$con=mysqli_connect("xx","xx","xx","xx");
// Check connection
if (mysqli_connect_errno()) {
echo "Błąd podczas łączenia z bazą danych: " . mysqli_connect_error
(); }
// escape variables for security
$Nick = mysqli_real_escape_string($con, $_POST['Nick']);
$Panstwo = mysqli_real_escape_string($con, $_POST['Panstwo']);
$Miasto = mysqli_real_escape_string($con, $_POST['Miasto']);
$sql="INSERT INTO Lokalizacja (Nick, Panstwo, Miasto)
VALUES ('$Nick', '$Panstwo', '$Miasto')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error
($con)); }
mysqli_close($con);
?>
delete.php
<?php
$con=mysqli_connect("xx","xx","xx","xx");
// Check connection
if (mysqli_connect_errno()) {
echo "Błąd podczas łączenia z bazą danych: " . mysqli_connect_error
(); }
$ID = mysqli_real_escape_string($con, $_POST['ID']);
$Nick = mysqli_real_escape_string($con, $_POST['Nick']);
$Panstwo = mysqli_real_escape_string($con, $_POST['Panstwo']);
$Miasto = mysqli_real_escape_string($con, $_POST['Miasto']);
mysqli_query($con,"DELETE FROM Lokalizacja WHERE ID='$ID', Nick='$Nick', Panstwo='$Panstwo', Miasto='$Miasto' ");
mysqli_close($con);
?>
Mógłby ktoś napisać jak zrobić by to działało ?