dropdownlist

hello,i’m new in framework yii

i just want to ask

how do dropdownlist and connect with database?

whats the correct coding to add in portfolio.php and MainContorller.php?

for example the interface will be like this6269

1.png


what coding can i put in this coding.

MainController.php

public function actionPortfolio() {

if (isset($_POST['submit'])) {


        //create new portfolio data row


		$Department = Department::model()->findAll();


        $CourseModel = new Course();


        $CourseModel->module = Yii::app()->request->getPost("programme");


        $CourseModel->code = Yii::app()->request->getPost("code");


		$CourseModel->name = Yii::app()->request->getPost("coursename");


        $CourseModel->user_id = Yii::app()->user->profile->user_id;


        $CourseModel->save(FALSE);





        $this->redirect("portfolio");


    }





    $this->render('portfolio', compact("title", "CourseModels"));


}

Portfolio.php

<?php $this->renderPartial("//layouts/_top"); ?>

<!-- content main container -->

<div class="main"> <!-- row -->

&lt;div class=&quot;row&quot;&gt;              &#60;&#33;-- col 12 --&#62;


    &lt;div class=&quot;col-md-12&quot;&gt;





    &lt;/div&gt;


    &#60;&#33;-- /col 12 --&#62;


&lt;/div&gt;


&#60;&#33;-- /row --&#62;

</div>

<!-- /content container -->

Post code where you try to add dropdownlist

Some example to start:

http://www.yiiframework.com/wiki/48/by-example-chtml/#hh5

http://www.yiiframework.com/doc/guide/1.1/en/form.view

i want that dropdownlist drag to database.

what the correct coding?

anybody…can teach me please?

Have you read references?