entries in the team table can be edit now
This commit is contained in:
51
app/public/edit_team.php
Normal file
51
app/public/edit_team.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("../scripts/connection.php");
|
||||
include("../scripts/functions.php");
|
||||
$user_data = check_login($con);
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
$row = get_team($con, $_GET['m_id'])->fetch();
|
||||
}
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
$row = get_team($con, $_POST['m_id'])->fetch();
|
||||
|
||||
if($_POST['team_name'] != $row['name']) {
|
||||
update_team_name($con, $_POST['m_id'], $_POST['team_name']);
|
||||
}
|
||||
|
||||
if($_POST['fire_department'] != $row['feuerwehr']) {
|
||||
update_team_fire_department($con, $_POST['m_id'], $_POST['fire_department']);
|
||||
}
|
||||
|
||||
header("Location: mannschaft.php");
|
||||
die;
|
||||
}
|
||||
|
||||
include("header_footer/header.php");
|
||||
?>
|
||||
<body>
|
||||
<div class="headline">
|
||||
<h2>Mannschaft bearbeiten</h2>
|
||||
</div>
|
||||
<div>
|
||||
<form method="post">
|
||||
<label for="team_name">Mannschaftsname</label>
|
||||
<input type="text" name="team_name" <?php echo "value=\"" . $row['name'] . "\""?> /><br>
|
||||
<label for="fire_department">Feuerwehr</label>
|
||||
<input type="text" name="fire_department" list="fire_departments" <?php echo "value=\"" . $row['feuerwehr'] . "\"" ?>/><br>
|
||||
<datalist id="fire_departments">
|
||||
<?php
|
||||
load_fire_departments($con);
|
||||
?>
|
||||
</datalist>
|
||||
<input type="hidden" name="m_id" <?php echo "value=\"" . $row['m_id'] . "\""?> />
|
||||
<input type="submit" value="Speichern"/>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
<?php
|
||||
$con = null;
|
||||
echo file_get_contents("header_footer/footer.html");
|
||||
?>
|
||||
@@ -13,6 +13,7 @@ function init() {
|
||||
user_edit_button();
|
||||
statistic_edit_button();
|
||||
station_edit_button();
|
||||
team_edit_button();
|
||||
}
|
||||
|
||||
var selected = null;
|
||||
@@ -77,4 +78,15 @@ function station_edit_button() {
|
||||
this.form.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function team_edit_button() {
|
||||
var button = document.getElementById('edit_team');
|
||||
if(button != null) {
|
||||
button.onclick = function() {
|
||||
var row = document.getElementsByClassName('selected')[0];
|
||||
document.getElementById('m_id').value = row.id;
|
||||
this.form.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,13 @@
|
||||
</div>
|
||||
<div>
|
||||
<form action="add_team.php" method="get">
|
||||
<input id="butto" type="submit" value="Mannschaft hinzufügen">
|
||||
<input id="button" type="submit" value="Mannschaft hinzufügen"/>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form action="edit_team.php" method="get">
|
||||
<input id="edit_team" type="button" value="Bearbeiten" class="edit" disabled="true"/>
|
||||
<input type="hidden" id="m_id" name="m_id">
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-div">
|
||||
|
||||
Reference in New Issue
Block a user