Answer the question
In order to leave comments, you need to log in
Based on what is the name of the $_POST array element formed in Yii when sending data from _form?
For example:
if(isset($_POST['Product']))
{
$model->attributes=$_POST['Product'];
if($model->save())
$this->redirect(array('view','id'=>$model->CODE));
}
Answer the question
In order to leave comments, you need to log in
It is possible to prescribe name for fields in htmlOptions. It is much cheaper and safer to specify a variable with the name of the working model class in the controller.
Z.Y. Better use HttpRequest instead of $_POST
In fact, when you generate a form in a view, for example, through TbActiveForm, you pass the model there. The fields are formed from the name of this model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question