diff --git a/admin/p/ff.php b/admin/p/ff.php index 48b30f5..7e72011 100644 --- a/admin/p/ff.php +++ b/admin/p/ff.php @@ -107,7 +107,7 @@ $header->showHeader("Feuerwehr"); ?> $.ajax({ url: "../scripts/vehicle.php", type: "POST", - data: "org=ff&ort" + ort + "&name=" + name + "&number=" + number + "&type=" + type, + data: "org=ff&ort=" + ort + "&name=" + name + "&number=" + number + "&type=" + type, success: function (resp) { $("#feedback").html(resp); } diff --git a/admin/scripts/vehicle.php b/admin/scripts/vehicle.php index 9d236b0..23dee87 100644 --- a/admin/scripts/vehicle.php +++ b/admin/scripts/vehicle.php @@ -36,26 +36,29 @@ if ($_POST) { if (isset($_POST['org'])) { if(strcmp($_POST['org'], "ff")) { - if (isset($_POST['ort']) && isset($_POST['name']) && isset($_POST['number']) && isset($_POST['type'])) { + if ($_POST['ort'] AND $_POST['name'] AND $_POST['number'] AND $_POST['type']) { $insert = $pdo->prepare("INSERT INTO feuerwehr (id, OrtID, Organistationskennung, Fahrzeugkennung, Fahrzeugtyp) VALUES (?,?,?,?,?)"); $select = $pdo->prepare("SELECT COUNT(OrtID) FROM feuerwehr WHERE OrtID = ?"); if ($select->execute(array($_POST ['ort']))) { - $count = $select->fetch(); + while ($row = $select->fetch()) { - if ($count <= 9) { - $count = $_POST['ort'] . "0" . $count; - } else { - $count = $_POST['ort'] . $count; + if ($row <= 9) { + $row = $_POST['ort'] . "0" . $row; + } else { + $row = $_POST['ort'] . $row; + } } - } - $insert->bindParam(1, $count); - $insert->bindParam(2, $_POST['ort']); - $insert->bindParam(3, $_POST['name']); - $insert->bindParam(4, $_POST['number']); - $insert->bindParam(5, $_POST['type']); - $insert->execute(); - echo "Eintrag vom Fahrzeug erfolgreich"; + $insert->bindParam(1, $row); + $insert->bindParam(2, $_POST['ort']); + $insert->bindParam(3, $_POST['name']); + $insert->bindParam(4, $_POST['number']); + $insert->bindParam(5, $_POST['type']); + $insert->execute(); + echo "Eintrag vom Fahrzeug erfolgreich"; + } + + } } diff --git a/include/ff.php b/include/ff.php index ea85b10..94f9703 100644 --- a/include/ff.php +++ b/include/ff.php @@ -1,5 +1,4 @@ num_rows > 0) { } ?>
-
- +

]

@@ -62,16 +60,26 @@ if ($result->num_rows > 0) { while ($frow = $fahrzeuge->fetch_assoc()) { ?> - + + + + 0) { ?> - - + + + +
- +
- \ No newline at end of file diff --git a/include/header.php b/include/header.php index 3f5c31e..1f9a427 100644 --- a/include/header.php +++ b/include/header.php @@ -6,7 +6,7 @@ * Time: 18:09 */ ?> - +