diff --git a/app/public/delete_station.php b/app/public/delete_station.php new file mode 100644 index 0000000..cb32d4f --- /dev/null +++ b/app/public/delete_station.php @@ -0,0 +1,20 @@ +prepare("DELETE FROM Station WHERE s_id = :s_id"); + $stmt->execute(['s_id' => $_POST['s_id']]); + } catch(PDOException $e) { + handle_pdo_exception($e); + } + } + + $con = null; + + header("Location: stationen.php"); + die; +?> \ No newline at end of file diff --git a/app/public/delete_team.php b/app/public/delete_team.php index f6d694a..c4aac9d 100644 --- a/app/public/delete_team.php +++ b/app/public/delete_team.php @@ -13,6 +13,8 @@ } } + $con = null; + header("Location: mannschaft.php"); die; ?> \ No newline at end of file diff --git a/app/public/js/edit_table.js b/app/public/js/edit_table.js index 7f3fb30..fabe8c8 100644 --- a/app/public/js/edit_table.js +++ b/app/public/js/edit_table.js @@ -15,6 +15,7 @@ function init() { station_edit_button(); team_edit_button(); team_delete_button(); + station_delete_button(); } var selected = null; @@ -109,4 +110,18 @@ function team_delete_button() { } } } +} + +function station_delete_button() { + var button = document.getElementById('delete_station'); + if(button != null) { + button.onclick = function() { + var row = document.getElementsByClassName('selected')[0]; + document.getElementById('s_id_delete').value = row.id; + let confirmAction = confirm("Wirklich löschen?"); + if (confirmAction) { + this.form.submit(); + } + } + } } \ No newline at end of file diff --git a/app/public/stationen.php b/app/public/stationen.php index f010403..9a002d0 100644 --- a/app/public/stationen.php +++ b/app/public/stationen.php @@ -23,6 +23,12 @@ +
+
+ + +
+