Esempio n. 1
0
        $query = delete_record($table, $field_key, $field_val);
        if ($query) {
            display_success("Data berhasil dihapus " . "| <a href='?" . $parameter_key . "kd_tabel=tb_categories' />Close</a>");
        } else {
            display_error("Gagal menghapus data <br>" . "(" . mysql_error() . ") | <a href='?" . $parameter_key . "kd_tabel=tb_categories' />Close</a>");
        }
    }
}
//-------------------------------FORM-----------------------------------------
start_form();
//form input
if (isset($_POST['AddNew'])) {
    start_div("class='col-md-6'");
    start_table("class='form'");
    start_div("class='form-group'");
    text_with_list_categories("Parent Category: ", "parent_category", $val_selected['parent_category'], false, true, "-", "class='form-control'");
    end_div();
    start_div("class='form-group'");
    text_field('Category Name: ', 'category_name', $val_selected['category_name'], true, "class='form-control'");
    end_div();
    start_div("class='form-group'");
    text_area('Description: ', 'description', $val_selected['description'], false, "class='form-control'");
    end_div();
    start_row();
    start_column();
    space();
    //spasi
    end_column();
    //div button
    start_div("class='btn-toolbar list-toolbar'");
    if ($_POST['AddNew'] != 'update') {
 start_table("class='form'");
 start_div("class='form-group'");
 $str = '';
 //for parameter get
 if (!empty($_POST['id_item'])) {
     //tanpa combobox
     text_label_with_hidden("Item: ", "id_item", $_POST['id_item'], $_POST['item_name']);
     $str = "&item=" . $_POST['id_item'];
     //isi parameter get
 } else {
     //dengan combobox
     text_with_list_items("Item: ", "id_item", $val_selected['id_item'], true, true, "-", "", "class='form-control'");
 }
 end_div();
 start_div("class='form-group'");
 text_with_list_categories("Category: ", "id_category", $val_selected['id_item'], true, true, "-", "class='form-control'");
 end_div();
 start_div("class='form-group'");
 text_area('Description: ', 'description', $val_selected['description'], false, "class='form-control'");
 end_div();
 start_row();
 start_column();
 space();
 //spasi
 end_column();
 //div button
 start_div("class='btn-toolbar list-toolbar'");
 if ($_POST['AddNew'] != 'update') {
     //add new
     submit_button('submit', '<i class="fa fa-save"></i> Add', "class='btn btn-primary'");
 } else {