another CGridView problem

Hello everyone.

My problem is that when I click another page number all the data from my database table is loaded though when my CGridView is loaded for the first time only those data is loaded that match my search parameters.

Here is my view

$this->widget('zii.widgets.grid.CGridView', array(



		array('name'=>'name','header'=>"Ім'я",'value'=>'htmlspecialchars_decode ($data->name,ENT_QUOTES)'),




		'header'=>'Дата народження'



		array('name'=>'ppnz','header'=>"Школа",'value'=>'htmlspecialchars_decode($data->ppnz->nazva." ".$data->ppnz->stupin." ".$data->ppnz->nomer_sh,ENT_QUOTES)'),








                ), ),),


This is my controller

$model = new Ppnz('search');



  $model->name = $_POST['sname'];

  $model->predmet = $_POST['spredmet'];

  $model->posada = $_POST['sposada'];

  $model->osvita = $_POST['osvita'];


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

My Ppnz model

public function search()


	$criteria=new CDbCriteria;





        $sort = new CSort();

	$sort->attributes = array(



		'desc'=>'ppnz.nazva desc',







	return new CActiveDataProvider('Ppnz', array(





What did I do wrong?


In my controller I have:



The search parameters are passed via get, not via post.

Maybe this cause your loss of data.

How do I specify my form action because this

<form method="GET" action="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=ppnzv/vyvid">

calls my index action, though for method="POST" it works Ok?

Actually it does not call any action. It results in this url


<form method="GET" action="<?php echo CHtml::normalizeUrl('controller/action'); ?>">

Or better:

<?php echo CHtml::beginForm()?>

Check the class reference for parameters of beginForm

Now my problem is solved. Thank you zaccaria for your hints. It really needs to use GET and not POST method.

And CHtml::beginForm() works perfect.

Just one hint for those who want the plain html like I first did: to make it work correct one can remove action="…"

and use r=controller/action as hidden field. But this of course is not Yii way. :)