51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?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");
|
|
?>
|