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
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 -->
<div class="row"> <!-- col 12 -->
<div class="col-md-12">
</div>
<!-- /col 12 -->
</div>
<!-- /row -->
</div>
<!-- /content container -->