44 lines
754 B
PHP
44 lines
754 B
PHP
<?php
|
|
include'database.php';
|
|
|
|
function reportCreation()
|
|
{
|
|
$data = $_POST;
|
|
$pdo = connectDatabase();
|
|
createReport($pdo, $data);
|
|
closeDatabase($pdo);
|
|
header('location: report.php');
|
|
}
|
|
|
|
function reportModification()
|
|
{
|
|
$data = $_POST;
|
|
$id = $_POST["id"];
|
|
$pdo = connectDatabase();
|
|
editReport($pdo, $data, $id);
|
|
closeDatabase($pdo);
|
|
header('location: report.php');
|
|
}
|
|
|
|
function reportDeletion()
|
|
{
|
|
$id = $_GET["delete"];
|
|
$pdo = connectDatabase();
|
|
deleteReport($pdo, $id);
|
|
closeDatabase($pdo);
|
|
header('location: report.php');
|
|
}
|
|
|
|
if (isset($_POST["create"])) {
|
|
reportCreation();
|
|
}
|
|
|
|
|
|
if (isset($_POST["edit"])) {
|
|
reportModification();
|
|
}
|
|
|
|
if (isset($_GET["delete"])) {
|
|
reportDeletion();
|
|
}
|