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");
|
||||
?>
|
||||
Reference in New Issue
Block a user