<?php

require '../../config.php';
require '../../db_functions.php';
require '../../db_queries.php';
$doctor = $_POST['doctor'];
$specialty = $_POST['specialty'];
if (delete_doctor_specialty($doctor, $specialty)) {
    header('Location: ../confirmation/doctor_specialty_deleted.php?name=' . get_doctor_name($doctor) . '&specialty=' . get_specialty($specialty));
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?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';
$id = $_POST['doctor'];
$name = get_doctor_name($_POST['doctor']);
if (delete_doctor($id)) {
    header('Location: ../confirmation/doctor_deleted.php?name=' . $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 = format($_POST['name']);
$condition_id = $_POST['condition'];
$doctor_id = $_POST['doctor'];
if (mysql_query("CALL add_patient('{$patient}', {$condition_id}, {$doctor_id})")) {
    header('Location: ../confirmation/patient_created.php?name=' . $_POST['name'] . '&condition=' . get_condition($_POST['condition']) . '&doctor=' . get_doctor_name($_POST['doctor']));
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?php

require '../../config.php';
require '../../db_functions.php';
require '../../db_queries.php';
$doctor_id = $_POST["doctor"];
$specialty_id = $_POST["specialty"];
if (insert_doctor_specialty($doctor_id, $specialty_id)) {
    header('Location: ../confirmation/doctor_specialty_added.php?name=' . get_doctor_name($doctor_id) . '&specialty=' . get_specialty($specialty_id));
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}
<?php

require '../../config.php';
require '../../db_functions.php';
require '../../db_queries.php';
$doctor_old_name = get_doctor_name($_POST['doctor_id']);
$doctor_new_name = format($_POST["doctor_new_name"]);
if (update_doctor_name($doctor_new_name, $_POST['doctor_id'])) {
    header('Location: ../confirmation/doctor_name_updated.php?oldname=' . $doctor_old_name . '&newname=' . $doctor_new_name);
} else {
    header('Location: ../../error.php?error=' . mysql_error());
}