require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $examID = fix_string($_POST['examID']);
    $question = fix_string($_POST['question']);
    $question_type = fix_string($_POST['questionType']);
    $questionID = fix_string($_POST['questionID']);
    edit_question($examID, $question, $questionID);
    switch ($question_type) {
        case 'mult_answers':
            $json_assoc_array = json_decode($_POST['answers']);
            $mult_answers = fix_input_assoc_array($json_assoc_array);
            // assoc array e.g {answer : 'true'}
            delete_answers($questionID, $question_type);
            create_multiple_choice_answers($questionID, $mult_answers);
            break;
        case 'single_answers':
            $answer = fix_string($_POST['answer']);
            delete_answers($questionID, $question_type);
            create_single_answer($answer, $questionID);
            break;
        case 'keyword_answers':
            $keywords = json_decode($_POST['answers']);
            $keywords = fix_input_array($keywords);
            remove_non_alphanumeric($keywords);
            delete_answers($questionID, $question_type);
            create_keyword_answers($questionID, $keywords);
            break;
    }
} else {
    go_home();
}
<?php

session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $exam_name = fix_string($_POST['newExam']);
    $exam_cat = fix_string($_POST['examCat']);
    remove_non_alphanumeric($exam_name);
    create_new_exam($exam_name, $exam_cat);
    increment_exams($exam_cat);
} else {
    go_home();
}
<?php

session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $new_cat_name = fix_string($_POST['new_cat']);
    remove_non_alphanumeric($new_cat_name);
    create_new_category($new_cat_name);
} else {
    go_home();
}