All fields must be filed!";
}
else {
// Send to DB
try {
$conn = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
$conn->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();
echo "Data inserted.
";
} catch (PDOException $e) {
echo "Error!: " . $e->getMessage() . "
";
}
}
}
function clear_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}