I am trying to get value from title and I did but after pressing save button the title is not saving in database
$model = new Translation();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$getfromtitle = Yii::$app->request->post('Translation')['translation_title'];
echo $getfromtitle;
echo "<br />";
$model->translation_drive_title = $getfromtitle;
echo $model->translation_drive_title;
echo "<br />";
echo "here";
die();
}
after killing the code, yes everything is printing as I wanted but after pressing save/submit button (of course removing the die() function to let the code continue), the title which I got from first input is not saving to the second input $model->translation_drive_title in db
Thank you all
You are saving model before assigning value to translation_drive_title
$model = new Translation();
if ($model->load(Yii::$app->request->post())) {
$model->translation_drive_title = Yii::$app->request->post('Translation')['translation_title'];
$model->save();
}