it is now possible to edit station entries
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("../scripts/connection.php");
|
||||
include("../scripts/functions.php");
|
||||
$user_data = check_login($con);
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
$row = get_station_all($con, $_GET['s_id'])->fetch();
|
||||
include("header_footer/header.php");
|
||||
}
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
$station = get_station_all($con, $_POST['station_id'])->fetch();
|
||||
$s_id = intval($station['s_id']);
|
||||
$name = strval($station['name']);
|
||||
$standort = strval($station['standort']);
|
||||
if($name != $_POST['station_name']) {
|
||||
update_station_name($con, $s_id, $_POST['station_name']);
|
||||
}
|
||||
|
||||
if($standort != $_POST['station_pos']) {
|
||||
update_station_pos($con, $s_id, $_POST['station_pos']);
|
||||
}
|
||||
header("Location: stationen.php");
|
||||
die;
|
||||
}
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div class="headline">
|
||||
<h2>Station bearbeiten</h2>
|
||||
</div>
|
||||
<div>
|
||||
<form method="post">
|
||||
<label for="station_name">Stations Namen:</label>
|
||||
<input type="text" name="station_name" <?php echo "value=\"" . $row['name'] . "\"" ?> /><br>
|
||||
<label for="station_pos">Stations Standort:</label>
|
||||
<input type="text" name="station_pos" <?php echo "value=\"" . $row['standort'] . "\""?>/><br>
|
||||
<input type="hidden" name="station_id" <?php echo "value=\"" . $row ['s_id'] . "\""?>/>
|
||||
<input type="submit" value="Speichern"/>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php
|
||||
$con = null;
|
||||
echo file_get_contents("header_footer/footer.html");
|
||||
?>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
$user_data = check_login($con);
|
||||
|
||||
include("header_footer/header.php");
|
||||
include("header_footer/header.php");
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -6,12 +6,13 @@ if (document.readyState == "complete") {
|
||||
}
|
||||
|
||||
function init() {
|
||||
if(document.getElementById('table') != null) {
|
||||
if(document.getElementById('table') != null && document.getElementsByClassName('edit')[0] != null) {
|
||||
highlight_row();
|
||||
}
|
||||
|
||||
user_edit_button();
|
||||
statistic_edit_button();
|
||||
station_edit_button();
|
||||
}
|
||||
|
||||
var selected = null;
|
||||
@@ -65,4 +66,15 @@ function statistic_edit_button() {
|
||||
this.form.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function station_edit_button() {
|
||||
var button = document.getElementById('edit_station');
|
||||
if(button != null) {
|
||||
button.onclick = function() {
|
||||
var row = document.getElementsByClassName("selected")[0];
|
||||
document.getElementById('s_id').value = row.id;
|
||||
this.form.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
include("../scripts/functions.php");
|
||||
$user_data = check_login($con);
|
||||
|
||||
include("header_footer/header.php");
|
||||
include("header_footer/header.php");
|
||||
?>
|
||||
|
||||
<body>
|
||||
@@ -17,6 +17,12 @@
|
||||
<input type="submit" value="Station anlegen"/>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form action="edit_station.php" method="get">
|
||||
<input id="edit_station" type="button" value="Station bearbeiten" class="edit" disabled="true"/>
|
||||
<input type="hidden" id="s_id" name="s_id"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-div">
|
||||
<table id="table">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user