function doDelete()
{
    @($id = $_POST['selector']);
    $key = count($id);
    //multi delete using checkbox as a selector
    for ($i = 0; $i < $key; $i++) {
        $inst = new Instructor();
        $inst->delete($id[$i]);
    }
    message("Faculty name(s) already Deleted!", "info");
    redirect('index.php');
}
示例#2
0
            }
            //
            header('Location: ' . BASE_URL . 'academia/instructors/success');
        } else {
            throw new Exception("Either you're trying to hack this app or something wrong went. In either case the\n            developers were just notified about this.");
        }
    } else {
        if (isBtnSavePrsd()) {
            $newInstructorFname = trim($_POST['f_name']);
            $newInstructorLname = trim($_POST['l_name']);
            Instructor::create($newInstructorFname, $newInstructorLname);
            header('Location: ' . BASE_URL . 'academia/instructors/success');
            exit;
        } else {
            if (isBtnDeletePrsd()) {
                Instructor::delete($_POST['delInstructorIdModal']);
                header('Location: ' . BASE_URL . 'academia/instructors/success');
                exit;
            }
        }
    }
} catch (Exception $e) {
    $errors[] = $e->getMessage();
}
/**
 * http://stackoverflow.com/a/4128377/2790481
 *
 * @param $needle
 * @param $instructors
 * @param bool $strict
 * @return bool