I want to assign a single POST value to a model's particular attribute. I tried doing following ,
$model->que1 = $_POST["id1"];
$data2 = $_POST["id1"] ;
first line is not working, instead when I do,
echo $model->que1;
it show '0'(zero), but when I do, echo $data2;
it shows the write value, what's the problem?
here's the entire code for controller action
public function actiongetname()
{
$model = new Questions();
$data = 'msg';
$data2 ="";
if(isset($_POST["id1"]))
{
$model->que1 = $_POST["id1"];
$data2 = $_POST["id1"] ;
}
echo ""+$model->que1;
echo $data2;
$this->renderPartial('getname',array ('model'=>$model,'msg'=>$data));
}
Any solution... where am I doing wrong?