예제 #1
0
<?php

require '../model/database.php';
require '../model/teachers_db.php';
if ($_POST['action'] == "delete_teacher") {
    $teacherID = $_POST['teacher_id'];
    delete_teacher($teacherID);
} else {
    $teacherID = $_POST['ID'];
    $firstName = $_POST['firstName'];
    $lastName = $_POST['lastName'];
    $userName = $_POST['username'];
    $password = $_POST['password'];
    if (!empty($teacherID) || !empty($firstName) || !empty($lastName) || !empty($userName) || !empty($password)) {
        add_teacher($teacherID, $firstName, $lastName, $userName, $password);
    }
}
header("Location: mteacher.php");
예제 #2
0
            if (empty($last_name)) {
                $error_msg .= "Last Name is required.<BR>";
            }
            if (empty($display_name)) {
                $error_msg .= "Display Name is required.<BR>";
            }
            if (empty($teacher_id)) {
                $error_msg .= "Teacher ID is required.<BR>";
            }
            if ($error_msg != "") {
                include 'teacher_modify.php';
                exit;
            } else {
                modify_teacher($teacher_id, $last_name, $first_name, $display_name);
            }
        }
        $teacherList = get_teacher_list();
        include 'teacher_list.php';
        exit;
        break;
    case 'delete_teacher':
        $teacher_id = filter_input(INPUT_GET, 'teacher_id');
        delete_teacher($teacher_id);
        $teacherList = get_teacher_list();
        include 'teacher_list.php';
        exit;
        break;
    default:
        display_error('Unknown teacher action: ' . $action);
        break;
}