예제 #1
0
 public function actionIndex()
 {
     $model = new ContactForm();
     if (isset($_POST['ContactForm'])) {
         $model->attributes = $_POST['ContactForm'];
         if ($model->validate()) {
             $emails = explode(',', $model->getAttributes()['email']);
             foreach ($emails as $key => $value) {
                 $model_email = $this->loadUpdateEmail();
                 $model_email->email = htmlspecialchars(trim($value));
                 $model_email->save();
             }
             Yii::app()->user->setFlash('formEmail', 'Your email save in DB.');
             $this->refresh();
         }
     }
     $this->render('form-email', ['model' => $model]);
 }