<?php

require_once '../../config.php';
require_once '../../db_functions.php';
require_once '../../db_queries.php';
$patient = $_POST['patient'];
$specialty = $_POST['specialty'];
$doctor = $_POST['doctor'];
if (delete_IsPatientOf($patient, $specialty, $doctor)) {
    header('Location: ../confirmation/patient_doctor_deleted.php?patient=' . get_patient($patient) . '&specialty=' . get_specialty($specialty) . '&doctor=' . get_doctor_name($doctor));
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?php

require_once '../../config.php';
require_once '../../db_functions.php';
require_once '../../db_queries.php';
$patient_id = $_POST['patient'];
$doctor_id = $_POST['doctor'];
$specialty_id = $_POST['specialty'];
$drug_id = $_POST['drug'];
$route_id = $_POST['route'];
$amount = $_POST['amount'];
$patient = get_patient($patient_id);
$drug = get_drug($drug_id);
if (mysql_query("CALL add_order({$patient_id}, {$specialty_id}, {$doctor_id}, {$drug_id}, {$route_id}, {$amount})")) {
    header('Location: ../confirmation/order_created.php?patient=' . $patient . '&drug=' . $drug);
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?php

require '../../config.php';
require '../../db_functions.php';
require '../../db_queries.php';
$patient_old_name = get_patient($_POST['patient_id']);
$id = $_POST['patient_id'];
$patient_new_name = format($_POST["patient_new_name"]);
if (update_patient_name($patient_new_name, $id) == TRUE) {
    header('Location: ../confirmation/patient_name_updated.php?oldname=' . $patient_old_name . '&newname=' . $patient_new_name);
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?php

require_once '../../config.php';
require_once '../../db_functions.php';
require_once '../../db_queries.php';
$patient_id = $_POST['patient'];
$condition_id = $_POST['condition'];
if (insert_HasCondition($patient_id, $condition_id) == TRUE) {
    header('Location: ../confirmation/patient_condition_added.php?patient=' . get_patient($patient_id) . '&condition=' . get_condition($condition_id));
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?php

require_once '../../config.php';
require_once '../../db_functions.php';
require_once '../../db_queries.php';
$name = get_patient($_POST['patient']);
$id = $_POST['patient'];
if (delete_patient($id) == TRUE) {
    header('Location: ../confirmation/patient_deleted.php?name=' . $name);
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}