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