setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO $table (specialCall, fromTime, toTime, frequencies, modes, operatorCall, operatorName, operatorEmail, operatorPhone) VALUES (:specialCall, :fromTime, :toTime, :frequencies, :modes, :operatorCall, :operatorName, :operatorEmail, :operatorPhone)"; $stmt = $conn->prepare($sql); $stmt->bindParam(':specialCall', $specialCall); $stmt->bindParam(':fromTime', $fromTime); $stmt->bindParam(':toTime', $toTime); $stmt->bindParam(':frequencies', $frequencies); $stmt->bindParam(':modes', $modes); $stmt->bindParam(':operatorCall', $operatorCall); $stmt->bindParam(':operatorName', $operatorName); $stmt->bindParam(':operatorEmail', $operatorEmail); $stmt->bindParam(':operatorPhone', $operatorPhone); $stmt->execute(); $_SESSION["msg"] = "Data inserted."; } catch (PDOException $e) { $_SESSION["msg"] = "Error!: " . $e->getMessage(); } } } function clear_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } header("Location: reservation.php");