summaryrefslogtreecommitdiff
path: root/intern.gospeladlershof.de/code/chor/insert.php
blob: f1ec3d01b55820b192c2040345635da48abea7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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: /");