Adding A Textinput Value As A Query Condition

How could I make use of a textinput field value as a Query condition?

What I want is this:

In my view:




<form id="formid">

 <input name="yrlevel"></input>

</form>



How will I link this two codes (I mean what should I do to submit this form to my Controller Action):




public function actionFetchregularload(){

		$criteria = new CDbCriteria;

		$criteria->limit = 15;

		$criteria->condition='semester = 1';

		$criteria->select = array('subjCode','subjDesc','lec','lab','units');

		$criteria->addSearchCondition('yrLvl', $_GET['yrLevel']);

		$data = CompeProspectusA::model()->findAll($criteria);

                ....



Or if theres an alternative way please…

why u looking for a alternative way? it not work?

If I’m not mistaken u can get dataProvider and show data with CviewList




if (isset($_GET['yrLevel'])){

    $model = new CompeProspectusA;

    $model->yrLvl = $_GET['yrLevel'];

    $data = $model->search();

}



if you call the form view in that action (actionFetchregularload), then the form will automatically submit to this action, just look at what happens in create and update forms in code generated by gii tool.

otherwise, you should be explicit to the form and say it where you want it to submit its data! simply add the "action" attribute to the form:




<form id="formid" method="get" action=" <?php echo $this->createUrl('actionNameHere') ?> ">

 <input name="yrlevel"></input>

</form>



that should solve the problem.