if ($values === null) $values = $this->p();
if (!is_array($values)) $values = [$values];
$fields = array_filter($this->fields(),function($v){return empty($v->extra);});
- #$fields = $this->fields();
- #debug($fields);
$where = $this->where($fields,$values);
if (empty($where)) {
public function out($v,$head=[],$conf=[]) { return $this->db()->out($v,$head,$conf); }
- private function url_referer($default='') {
+ public function url_referer($default='') {
if (self::p('referer')) {
return urldecode($this->p('referer'));
} elseif(!empty($default)) {
#if (!$keys) return; #$this->not_implemented('Table has no fields');
#bye(array_combine($keys,$values));
- $this->table->html_edit(array_combine($keys,$values),'?',$add);
+ $this->table->html_edit(array_combine($keys,$values),$this->table->base.($add ? 'insert/' : 'update/'),$add);
}
public function table_rows($fct=null) {
} elseif ($action == 'insert' and $this->perm >= self::WRITE) {
if (!$this->table->insert($_POST)) $this->error('insert');
- header('Location: '.$this->page->url_referer());
+ header('Location: '.$this->table->base);
} elseif ($action == 'update' and $this->perm >= self::WRITE) {
if (!$this->table->update($_POST)) $this->error('update');
- header('Location: '.$this->page->url_referer());
+ header('Location: '.$this->table->base);
} elseif ($action == 'rm' and $this->perm >= self::DELETE) {
- if (!$this->table->delete($_POST)) $this->error('rm');
- header('Location: '.$this->page->url_referer());
+ if (!$this->table->delete($_POST)) 1;#$this->error('rm');
+ header('Location: '.$this->table->base);
} else {