I use Yii2 and I have this problem. This is my Update action:
public function actionUpdate($id)
{
$searchModel = new AutoriSearch();
$searchModel1 = new EditoriSearch();
$searchModel2 = new LuoghiSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider1 = $searchModel1->search(Yii::$app->request->queryParams);
$dataProvider2 = $searchModel2->search(Yii::$app->request->queryParams);
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->IDBibliografia]);
}
return $this->render('update', [
'model' => $model,
'dataProvider' => $dataProvider,
'dataProvider1' => $dataProvider1,
'dataProvider2' => $dataProvider2,
'searchModel' => $searchModel,
'searchModel1' => $searchModel1,
'searchModel2' => $searchModel2
]);
}
I want, after saving, to return to the previous page. So the problem is in redirect raw. So, I click the button from the index, to go to the update action. Then, when I save the update, I want to return to index (but it need to be the same previous page with the same previous Url). I found various solution on Stack, but anything can help me. I need help, thank you!!!!