Implement report CRUD functionalities
This commit is contained in:
40
src/report_management.php
Normal file
40
src/report_management.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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();
|
||||
}
|
||||
Reference in New Issue
Block a user