コード例 #1
0
 protected function addAction()
 {
     if ('' !== $_POST['title'] && '' !== $_POST['content']) {
         $article = new ArticlesModel();
         $article->title = htmlspecialchars($_POST['title']);
         $article->content = htmlspecialchars($_POST['content']);
         $article->save();
         header('Location: ../Articles/added');
     } else {
         echo '<p>Вы не заполнили поля заголовка и/или контента.</p>';
     }
 }