Ejemplo n.º 1
0
#*  Checking for post vars.  Go back to form if none found.
#****************************************************************************
if (count($_POST) == 0) {
    header("Location: ../admin/materials_list.php");
    exit;
}
#****************************************************************************
#*  Validate data
#****************************************************************************
$dm = new Dm();
$dm->setCode($_POST["code"]);
$_POST["code"] = $dm->getCode();
$dm->setDescription($_POST["description"]);
$_POST["description"] = $dm->getDescription();
$dm->setImageFile($_POST["imageFile"]);
$_POST["imageFile"] = $dm->getImageFile();
if (!$dm->validateData()) {
    $pageErrors["description"] = $dm->getDescriptionError();
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../admin/materials_edit_form.php");
    exit;
}
#**************************************************************************
#*  Update domain table row
#**************************************************************************
$dmQ = new DmQuery();
$dmQ->connect();
$dmQ->update("material_type_dm", $dm);
$dmQ->close();
#**************************************************************************