Exemplo n.º 1
0
    } else {
        $field_names = array('item_id', 'percent_off', 'comment');
        $field_data = array("{$item_id}", "{$percent_off}", "{$comment}");
    }
} else {
    //outputs error message because user did not use form to fill out data.
    echo "{$lang->mustUseForm}";
    exit;
}
switch ($action) {
    //finds out what action needs to be taken and preforms it by calling methods from dbf class.
    case $action == "insert":
        $dbf->insert($field_names, $field_data, $tablename, true);
        break;
    case $action == "update":
        $dbf->update($field_names, $field_data, $tablename, $id, true);
        break;
    case $action == "delete":
        $dbf->deleteRow($tablename, $id);
        break;
    default:
        echo "{$lang->noActionSpecified}";
        break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_discounts.php"><?php 
echo $lang->manageDiscounts;
?>
--></a>