I want to create two submit button in my form. The first button (I use Html::submitButton
) link to actionCreate in Controller redirect to index. I want to redirect the second button to its form but it doesn't work. Here is my second button:
<?= Html::a('<span class="glyphicon glyphicon-floppy-disk"></span> Save', ['simpan'], ['class' => 'btn btn-primary']) ?>
and this is my actionSimpan in Controller
public function actionSimpan()
{
$model = new Armada();
if ($model->load(Yii::$app->request->post())) {
// get the instance of the uploaded file
$imageName = $model->NAMA_ARMADA;
$model->photo = UploadedFile::getInstance($model,'photo');
$model->photo->saveAs('uploads/'.$imageName.'.'.$model->photo->extension);
//save the path in the column
$model->IMG_ARMADA = 'uploads/'.$imageName.'.'.$model->photo->extension;
$model->save();
return $this->redirect(['index']);
}
return $this->render('create', [
'model' => $model,
]);
}
I tried the Html::submitInput
but it doesn't work. What should I do to make it work? Thank you!