Пример #1
0
if (tool::securePost('action') == "save" && tool::securePost('id')) {
    # fill customer with submitted data
    $customerInst->id = tool::securePost('id');
    $customerInst->fill(tool::securePostAll());
    $status = $customerInst->update();
} elseif (tool::securePost('action') == "save") {
    $customerInst->fill(tool::securePostAll());
    $status = $customerInst->insert();
}
if (tool::securePost('action') == "delete") {
    $customerInst->id = tool::securePost('id');
    $customerInst->delete();
}
if (tool::securePost('action') == "edit") {
    $status = 0;
    $customerInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form
if (!$status) {
    echo "<h2>" . $lang['common_editRecord'] . " (<a href=\"" . $toolInst->encodeUrl("index.php?content=" . $content) . "\">" . $lang['common_newRecord'] . "</a>)</h2>\n";
} else {
    $customerInst->clear();
    echo "<h2>" . $lang['common_newRecord'] . "</h2>\n";
}
?>

<form method="post" name="form2">
<input type="hidden" name="action" value="save">
<input type="hidden" name="id" value="<?php 
echo $customerInst->id;
Пример #2
0
    ?>
):&nbsp;</td><td><input value="<?php 
    echo $projectInst->budget;
    ?>
" maxlength="10" type="text" name="budget" size="10"></td></tr>
    <tr>
      <td><?php 
    echo $lang['common_customer'];
    ?>
:&nbsp;</td>
      <td><select name="customerid">
        <?php 
    $customerInst = new customer();
    $list = $customerInst->getList();
    while ($element = current($list)) {
        $customerInst->activate($element);
        $selected = "";
        if ($customerInst->id == $projectInst->customerId) {
            $selected = "selected";
        }
        echo "<option " . $selected . " value=\"" . $customerInst->id . "\">" . $customerInst->company . "\n";
        next($list);
    }
    ?>
      </select></td>
    </tr>
    <tr>
      <td><?php 
    echo $lang['common_manager'];
    ?>
:&nbsp;</td>