2020-06-17 08:42:53 +02:00
|
|
|
<?php
|
|
|
|
include'database.php';
|
|
|
|
|
2020-06-22 23:00:43 +02:00
|
|
|
function patientCreation()
|
|
|
|
{
|
|
|
|
$data = $_POST;
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
createPatient($pdo, $data);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
header('location: patient.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
function patientModification()
|
|
|
|
{
|
|
|
|
$data = $_POST;
|
|
|
|
$id = $_POST["id"];
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
editPatient($pdo, $data, $id);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
header('location: patient.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
function patientDeletion()
|
|
|
|
{
|
|
|
|
$id = $_GET["delete"];
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
deletePatient($pdo, $id);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
header('location: patient.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
function patientFind()
|
|
|
|
{
|
|
|
|
$data = $_POST;
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
findPatient($pdo, $data);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
$search = $data["search_box"];
|
|
|
|
header("location: patient.php?search=$search");
|
2020-06-17 08:42:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST["create"])) {
|
|
|
|
patientCreation();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_POST["edit"])) {
|
|
|
|
patientModification();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET["delete"])) {
|
|
|
|
patientDeletion();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST["search"])) {
|
|
|
|
patientFind();
|
|
|
|
}
|