diff options
Diffstat (limited to 'intern.gospeladlershof.de/code/chor/insert.php')
| -rw-r--r-- | intern.gospeladlershof.de/code/chor/insert.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/chor/insert.php b/intern.gospeladlershof.de/code/chor/insert.php new file mode 100644 index 0000000..f1ec3d0 --- /dev/null +++ b/intern.gospeladlershof.de/code/chor/insert.php @@ -0,0 +1,24 @@ +<?php + +require_once __DIR__ . '/../db.php'; +require_once __DIR__ . '/../session.php'; + +$db = get_db(); + +$nachricht = $_REQUEST["termin"]; + +try { + $stmt = $db->prepare("INSERT INTO chor (id, nachricht) VALUES(NULL, :nachricht);"); + $stmt->bindValue(":nachricht", $nachricht); + $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: /"); |
