54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
|
<?php
|
||
|
include'database.php';
|
||
|
|
||
|
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");
|
||
|
}
|
||
|
|
||
|
if (isset($_POST["create"])) {
|
||
|
patientCreation();
|
||
|
}
|
||
|
|
||
|
|
||
|
if (isset($_POST["edit"])) {
|
||
|
patientModification();
|
||
|
}
|
||
|
|
||
|
if (isset($_GET["delete"])) {
|
||
|
patientDeletion();
|
||
|
}
|
||
|
|
||
|
if (isset($_POST["search"])) {
|
||
|
patientFind();
|
||
|
}
|