Calling A View Attribute From The Controller

hi all,

I am trying to get the selected value off a drop down list and into an action in my controller.

in my view i have a table which contains a set of drop downs,

part of my view:-




<table>   

<tr>

<td>

    <b>Select Class</b>

    <?php

        $sql='SELECT s.classId 

              FROM schoolclasses s 

              WHERE s.classId NOT IN (SELECT DISTINCT c.classId 

                                      FROM classtimetable c)';

        $connection=Yii::app()->db; 

        $command=$connection->createCommand($sql);

    ?>

    <?php 

        echo $form->dropDownList($model,'classId',CHtml::listData($command->query(), 'classId', 'classId'), array('empty'=>'---Class---','style' => 'width:100px;')); 

    ?>        

</td>

</tr>

    

<tr><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th></tr>

<tr>


    <td>

    <?php 

        echo $form->dropDownList($model,'[mon_p1]subjectName', CHtml::listData(Subjects::model()->findAll(), 'subjectName', 'subjectName'), array('empty'=>'---Subject---','style' => 'width:100px;')); 

    ?>

    </td>


    <td>

    <?php 

        echo $form->dropDownList($model,"[tue_p1]subjectName", CHtml::listData(Subjects::model()->findAll(), 'subjectName', 'subjectName'), array('empty'=>'---Subject---','style' => 'width:100px;')); 

    ?>

    </td>



my controller:-




public function actionFullCreate() 

     {  

       $model=  Classtimetable::model();

      

        if(Yii::app()->user->title=='admin')

        {

            try

            {

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

		{

                    $class_id=$_POST['Classtimetable']['classId']; 

                    print_r($class_id);

                   [b] $m_p1=$_POST['Classtimetable']['[mon_p1]subjectName'];[/b]

                    }

            }

            

            catch (CDbException $e)

            {

                     Yii::app()->clientScript->registerScript('notifycreate',"

                        alert('Entry already exists');

                            ",CClientScript::POS_READY);

            }    

                $this->render('fullCreate',array('models'=>$model));

        }

        

        else

        {

        throw new CHttpException(401,'You are not authorized to perform this function .   ');

        }

    }

}



But when i execute my action, i get a php notice saying

Where do i have to define [mon_p1]subjectName?

The model contains an attribute called subjectName, but i want to get a set of subject names and insert it onto the DB in one go.

Can someone help me get it fixed?.

Thanks a lot, for your time!

Cheerz! :)

Found it! posting here hoping someone will find it useful… :)


$m_p1=$_POST['Classtimetable']['mon_p1']['subjectName']; 

Hope i didnt waste anyone’s time…

Thanks a lot…

Cheerz!

P.S : use printr($_POST) in your controller for debugging… :)