0) { $db = new Mysql(); $db->throwExceptions = true; try { // begin transaction $db->transactionBegin(); // Delete from target table $filter = array(); $filter[""] = Mysql::SQLValue($_POST['']); if (DEMO === true || $db->deleteRows('', $filter)) { // ALL OK $db->transactionEnd(); $_SESSION['msg'] = Utils::alert(UPDATE_SUCCESS_MESSAGE, 'alert-success has-icon'); } else { $error = $db->error(); $db->transactionRollback(); throw new \Exception($error); } } catch(\Exception $e) { $msg_content = DB_ERROR; if (ENVIRONMENT == 'development') { $msg_content .= '
' . $e->getMessage() . '
' . $db->getLastSql(); } $_SESSION['msg'] = Utils::alert($msg_content, 'alert-danger has-icon'); } } // reset form values Form::clear('form-delete-'); // redirect to list page if (isset($_SESSION['active_list_url'])) { header('Location:' . $_SESSION['active_list_url']); } else { header('Location:' . ADMIN_URL . ''); } // if we don't exit here, $_SESSION['msg'] will be unset exit(); } // END if POST $ = $pk; // select name to display for confirmation $qry = 'SELECT FROM WHERE = ' . Mysql::sqlValue($) . ' LIMIT 1'; $db = new Mysql(); $db->query($qry); $count = $db->rowCount(); if (!empty($count)) { $row = $db->row(); $display_value = $row->; } else { // this should never happen // echo $db->getLastSql(); exit('QRY ERROR'); } $form = new Form('form-delete-', 'vertical', 'novalidate', 'bs4'); $form->setAction(ROOT_RELATIVE_URL . 'admin//delete/' . $); $form->startFieldset(); $form->addInput('hidden', '', $); $form->addHtml('
'); $form->addRadio('delete-', YES, 1); $form->addRadio('delete-', NO, 0); $form->printRadioGroup('delete-', '' . DELETE_CONST . ' "' . $display_value . '" ?'); $form->addBtn('button', 'cancel', 0, '' . CANCEL, 'class=btn btn-warning legitRipple, onclick=history.go(-1)', 'btn-group'); $form->addBtn('submit', 'submit-btn', 1, SUBMIT . '', 'class=btn btn-success legitRipple', 'btn-group'); $form->setCols(0, 12); $form->centerButtons(true); $form->printBtnGroup('btn-group'); $form->addHtml('
'); $form->endFieldset(); $form->addPlugin('nice-check', 'form', 'default', array('%skin%' => 'green')); $form->addPlugin('select2', 'select', 'default');