I am not able to redirect a custom form to specific action.
What I am trying is
<?= Html::submitButton( 'delete-selected' ,['class' => 'btn btn-primary']) ?>
here delete-selected
is my custom action in controller appointment
.
I have also tried like this:
- public function actionDeleteForm()
- {
- return $this->render('delete');
- return $this->redirect(['delete-selected']);
- }
-
- public function actionDeleteSelected()
- {
- Appointment::deleteAll(['doctor_name' =>4]);
- return $this->redirect(['index']);
- }
What I am trying to do is actually delete some records using the form. The form name is delete
having a select drop-down field.
I want to post the data to action deleteselected
and use the $_POST variable in the delete query.
How can I do this?
Thanks.