diff --git a/index.php b/index.php
index 19d775b..e409713 100755
--- a/index.php
+++ b/index.php
<th>Status</th>
<th>Ruokaraha</th>
<th>Muuta</th>
+ <th>Muokkaus</th>
</tr>
<!-- Ota tiedot tiedot kannasta -->
<?php
diff --git a/luku.php b/luku.php
index 5b62f55..9da5f7f 100755
--- a/luku.php
+++ b/luku.php
echo "<td>" . $row["status"] . "</td>";
echo "<td>" . $row["ruokaraha"] . "</td>";
echo "<td>" . $row["muuta"] . "</td>";
+ echo "<td>" . // Poista nappi
+ "<form action='poista.php' method='POST'>
+ <input type='hidden' id='id' name='id' value={$row['id']}>
+ <input type='submit' value='Poista'>
+ </form>"
+ . "</td>";
echo "</tr>";
}
}
diff --git a/poista.php b/poista.php
new file mode 100644
index 0000000..113b830
--- /dev/null
+++ b/poista.php
+<?php
+// Yhdistä tietokantaan
+include "connect.php";
+// Poista tietokannasta yksi tyyppi ideen avulla
+$id = $_POST["id"];
+$sql = "DELETE FROM oppilaat WHERE id={$id}";
+
+if ($conn->query($sql) === TRUE) {
+ echo "Arvo poistettu onnistuneesti";
+} else {
+ echo "Virhe poistaessa arvoa: " . $conn->error;
+}
+$conn->close();
+// Redirect
+$newURL = "index.php";
+header('Location: '.$newURL);
+die();
+?>