Bootstrap.widgets.tbselect2

//controller

public function actionCreate(){

$model=new EmployeeSchedule;


$employee = Employee::model()->findAll();





if(isset($_POST['EmployeeSchedule']))


{


echo $_POST['emp_sel'];


  $model->attributes=$_POST['EmployeeSchedule'];


  if($model->save())


    $this->redirect(array('view','id'=>$model->id));


  }


    $this->render('create',array(


    'employee'=>$employee,


    'model'=>$model,));

}

//view

$this->widget(

                'bootstrap.widgets.TbSelect2',


                array(


                        'asDropDownList' => false,


                        'name' => 'emp_sel',


                        'options' => array(


                                'tags' => $employee['firsname'],


                                'placeholder' => 'Type the name of employee and press enter to select',


                                'width' => '100%',


                                'tokenSeparators' => array(',', ' ')


                                )


                     )


             );


?>

//Error

PHP notice

Undefined index: firstname

Please Help.

:( I want to view the firstname field and save the Id…

Thanks for help

change your firsname to firstname look at the comments


//view

$this->widget(

'bootstrap.widgets.TbSelect2',

array(

'asDropDownList' => false,

'name' => 'emp_sel',

'options' => array(

'tags' => $employee['firsname'], // I believe this is $employee['firstname']

'placeholder' => 'Type the name of employee and press enter to select',

'width' => '100%',

'tokenSeparators' => array(',', ' ')

)

)

);

?>

Undefined index: firstname