public function contactAction(Request $request) { $form = new ContactModel($request); $msg = $request->get('msg'); if ($request->isPost()) { if ($form->isValid()) { $this->redirect('/index.php?rout=index/contact&id=3&msg=Сообщение отправленно'); $form->saveToDb(); mail('*****@*****.**', 'HELLOW', $form->name . PHP_EOL . $form->email . PHP_EOL . $form->message . PHP_EOL . $form->date); $form->name = ''; $form->email = ''; $form->message = ''; } else { $msg = 'Fail!!!'; } } $args = array('form' => $form, 'msg' => $msg); return $this->render('contact', $args); }