Ejemplo n.º 1
0
<?php

require '../../include/global_functions.php';
loggedInOrRedirect();
$formula_dao = new FormulaDAO();
$new_device_discount = $formula_dao->findOneByName('new_device_discount');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if ($_POST['variable_1'] && $_POST['variable_2']) {
        $formula_dao->updateByName('new_device_discount', (double) $_POST['variable_1'], (double) $_POST['variable_2']);
        die(header('Location: manage_formulas.php?succeeded=yes'));
    }
    die(header('Location: manage_formulas.php?succeeded=no'));
}
$page['title'] = 'Manage formulas';
require '../../include/header.inc';
require '../../include/index.inc';
if ($_GET['succeeded']) {
    if ($_GET['succeeded'] == 'yes') {
        print '<div class="text-success">' . t('Changes saved successfully') . '.</div><br>';
    } else {
        print '<div class="text-danger">' . t('No changes were saved') . '.</div><br>';
    }
}
?>
<h3><?php 
echo t('Modify formulas');
?>
</h3>
<form action="?" method="POST">
    <b><?php 
echo t('Discount formula');