From acb69ee4fd6f4f6dfcf719f1e1d890e596886d36 Mon Sep 17 00:00:00 2001 From: Matthieu Guffroy <mattgu74@gmail.com> Date: Tue, 17 Jun 2014 23:53:53 +0200 Subject: [PATCH] Form: call insert or update --- class/form.php | 7 +++++++ class/objet.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/class/form.php b/class/form.php index bd85a4a..4baf18a 100644 --- a/class/form.php +++ b/class/form.php @@ -25,6 +25,13 @@ class Form { } // If all validators ok, commit + if($success) { + if($this->action == "Modifier") { + $this->object->update(); + } else { + $this->object->insert(); + } + } } else { $post = false; } diff --git a/class/objet.php b/class/objet.php index 6de0819..6f993f4 100644 --- a/class/objet.php +++ b/class/objet.php @@ -51,7 +51,7 @@ class Objet return $ret; } - public static function insertAll() + public static function insert() { $className = get_called_class(); $dbName = lcfirst($className); -- GitLab