예제 #1
0
} else {
    $id = $_REQUEST["id"];
    $_REQUEST['mode'] = 'e';
}
// if form was submitted:
if ($_POST['commit'] == "Cancel") {
    header("Location:setting_list.php");
    exit;
}
if ($_POST['commit'] == "Save Setting") {
    echo "he";
    echo "<br>" . $id;
    if ($id == 0) {
        // insert
        $db = new GenericDb();
        $db->arrayInsert("setting", $_REQUEST);
        // redirect to listing list
        header("Location:setting_list.php");
        exit;
    } else {
        // update
        $db = new GenericDb();
        $db->arrayUpdate("setting", $_REQUEST, "id = :id", array(":id" => $id));
        // redirect to listing list
        header("Location:setting_list.php");
        exit;
    }
} else {
    if ($_REQUEST['mode'] == 'e') {
        //listing
        $db = new GenericDb();