Passing A Dropdown Value To Model

Ok , my last post wasn’t clear enough , and I modified my code since than , so here is my question:

I’m failing to pass a Week’s id from a dropdownlist to a model , in order to use it in the sql queries which are in that model.

What I’m failing to understand is:

  1. in the CHtml::dropDownList , 1st parameter is the name , and the third is the list , but what is the second parameter? In all of the examples there was simply a varaible , but no explanation on whom it belongs?

  2. after I select from the dropdownlist , how can I pass the selected value to a model?

Thank you,

Mark.

The API is very helpful:

The second parameter determines the option that will be selected.

You can get to the value that’s been selected in your action using:




Yii::app()->request->getPost('nameYouSet');



You can assign that to an attribute of your model or pass it in to a model method as you please.