This is my url:
localhost/adi/index.php?r=comments/create&type=Affiliate&sid=2&memid=ADIDOM1430002
I want to get the values from url in the _form of respective model(Comments) and when save is insert these values in table along with some values which are filled in the form.
And in actionCreate method of controller, can I return them in $_POST[comments], so that my task becomes easy!!
Bizley
(Bizley)
September 4, 2014, 11:39am
2
This is my url:
localhost/adi/index.php?r=comments/create&type=Affiliate&sid=2&memid=ADIDOM1430002
I want to get the values from url in the _form of respective model(Comments) and when save is insert these values in table along with some values which are filled in the form.
And in actionCreate method of controller, can I return them in $_POST[comments], so that my task becomes easy!!
$type = Yii::app()->request->getParam('type');
public function actionCreate()
{
$model=new Company;
if(isset($_POST['Company']))
{
$model->attributes=$_POST['Company'];
if(!empty($_GET)){
$model->setAttribute("type",Yii::app()->request->getParam('type'));
$model->setAttribute("memid",Yii::app()->request->getParam('memid'));
}
$model->save();
}
}
Bizley
(Bizley)
September 4, 2014, 11:59am
4
Friendly reminder: please don’t encourage people to access superglobal arrays directly.
How to write secure Yii applications
Thanks buddy, it worked!!