diff options
| author | Horus | 2016-09-27 20:02:34 +0200 |
|---|---|---|
| committer | Horus | 2016-09-27 20:02:34 +0200 |
| commit | a3ca59de099d04b849b368f5867dd79c52e0424a (patch) | |
| tree | a65b18429e86437a7d0a96ab790dd26b51c8a3aa /intern.gospeladlershof.de/code/proben/insert.php | |
| parent | f70f746b5951e29eef449f962d5f531ed4a5961f (diff) | |
| download | gospeladlershof.de-a3ca59de099d04b849b368f5867dd79c52e0424a.tar.gz | |
Fügt das Backend erneut hinzu.
Diffstat (limited to 'intern.gospeladlershof.de/code/proben/insert.php')
| -rw-r--r-- | intern.gospeladlershof.de/code/proben/insert.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/proben/insert.php b/intern.gospeladlershof.de/code/proben/insert.php new file mode 100644 index 0000000..df0e257 --- /dev/null +++ b/intern.gospeladlershof.de/code/proben/insert.php @@ -0,0 +1,29 @@ +<?php + +require_once __DIR__ . '/../db.php'; +require_once __DIR__ . '/../session.php'; + +$db = get_db(); + +$termin = $_REQUEST["termin"]; +$uhrzeit = $_REQUEST["uhrzeit"]; +#$bemerkung = $_REQUEST["bemerkung"]; + +try { + $stmt = $db->prepare("INSERT INTO proben (id, termin, uhrzeit, bemerkung) VALUES(NULL, :termin, :uhrzeit, :bemerkung);"); + + $stmt->bindValue(":termin", $termin); + $stmt->bindValue(":uhrzeit", $uhrzeit); + $stmt->bindValue(":bemerkung", null); + + $stmt->execute(); +} catch ( Exception $e ) { + $_SESSION["error"] = $e->getMessage(); + error_log($e->getMessage()); +} + +if ( empty($_SESSION) || is_null($_SESSON["error"]) ) { + $_SESSION["success"] = "Erfolgreich eingetragen!"; +} +header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); +header("Location: /"); |
