public function Insert() { global $obj, $model; include_once 'Model/usertype.php'; $model = new Usertype(); if (isset($_POST['btnSubmit'])) { foreach ($_POST as $key => $value) { try { $model->{$key} = $value; } catch (Exception $ex) { } } if ($model->Insert()) { print '<span class="success">User type Created</span>'; $model = new Usertype(); } else { print '<span class="error">' . $model->Error . '</span>'; } } include_once 'View/Usertype/insert.php'; }