if (isset($_GET['action_id'])) {
$_OneAction = $this->_action->findOne();
$this->_tpl->assign('next_op', "update");
} else {
$_OneAction['enable'] = 1;
$this->_tpl->assign('next_op', "add");
}
$this->_tpl->assign("OneAction", $_OneAction);
if ($_POST['next_op'] == "update") {
if ($this->_action->actions_update()) {
$_message = "修改成功!";
} else {
$_message = "修改失敗!";
}
}
public function actions_update($_selectData = array())
{
$_where = array("action_id='{$this->_R['action_id']}'");
if (!$this->_check->oneCheck($this, $_where)) {
return;
}
if (!$this->_check->addCheck($this)) {
return;
}
$_selectData = empty($_selectData) ? $this->_fields : $_selectData;
$_updateData = $this->getRequest()->filter($_selectData);
parent::update($_where, $_updateData);
return $this->_R['action_id'];
}
<input type="hidden" name="action_id" value="<{$OneAction.action_id}>">