How to clear the form after sending? Or maybe I misunderstood?
I send the data through the form, and turn to a new page. If I update it, the form is sent again.
I usually applied
$hostname = Yii::$app->request->hostInfo; header("Location: ".$hostname."/basic/web/index.php?r=index/contact"); exit(); And everything works fine. But in this case, the redirect doesn't suit me, because I need to display the page.
public function actionContact() { $model = new Contact(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { unset($_POST);//Этот варинат не помогает unset($_POST['Contact']);//Этот варинат не помогает unset($_POST['textarea']);//Этот варинат не помогает $model->textarea = null; //Этот варинат не помогает //--------------------------------- return $this->render('contact_yes'); //Мне нужна эта страница, потому ридеректить нельзя } else { return $this->render('contact', ['model' => $model]); } } If possible, mini-question 2, why is this happening?