I want to show a form in the frontend which when filled will, fill up data in two or more tables in a database. I am using Active Record.
How can I do that?
I want to show a form in the frontend which when filled will, fill up data in two or more tables in a database. I am using Active Record.
How can I do that?
This question has already been posted in this forum many many times…
Check this wiki article - http://www.yiiframework.com/wiki/218/how-to-use-single-form-to-collect-data-for-two-or-more-models-cactiveform-and-ajax-validation-edition
Hi,
you can edit your controller’s render, for example like below:
Controller:
// buyer and seller is the model you want to show in the form
public function actionIndex(){
$modelA = new buyer;
$modelB = new seller;
…
$this->render(‘index’,array(‘modelA’=>$modelA,‘modelB’=>$modelB));
}
View
In view u can use this 2 model in the form
If i got any mistake, please amend it. Hope this can help you