pagination

I have a code in controller

public function actionSearchResult()

{


 	 $criteria_user = new CDbCriteria;


 	 $criteria_user->condition='username like'  . ' "%' . $_POST['medics'] . '%"' . ' AND '


													. 'city like' . ' "' . $_POST['regions'] . '"';


	 if($_POST[price_start]=="" or $_POST[price_end]=="")


	 {


	 	$withOption= array('doctor123');


	 }


	 else 


	 {


	 	$withOption= array('doctor');


	 }											


 	 $pages = new CPagination(User::model()->with($withOption)->count($criteria_user));		  		  		


	 $pages->pageSize=self::PAGE_SIZE;


	 $pages->applyLimit($criteria_user);


 	 $user = User::model()->with($withOption)->findAll($criteria_user);





	$this->render('searchResult', array(


			'doctor'=>$user,


			'pages'=>$pages,


			'country'=>$country,


	 ));				


 }

And in Models User I have code:

*/

public function relations()


{


	// NOTE: you may need to adjust the relation name and the related


	// class name for the relations automatically generated below.


	return array(


		'doctor' => array(self::HAS_ONE, 'Doctor', 'member_id', 'with'=>'language','condition'=>'price >= ' . '"' . $_POST['price_start'] . '"' 


																				. ' AND price <=' . '"' . $_POST['price_end'] . '"'),


		'doctor123' => array(self::HAS_ONE, 'Doctor', 'member_id', 'with'=>'language'),																					


		'country'=> array(self::HAS_MANY, 'Country', 'name','condition'=>'code like "%' . $_POST['country'] . '%"'),


	);


}

At the moment, I click the pages, $criteria_user->condition is null, i don’t go to the pages #2, #3

sorry because my English is very poor.

thanks

try this




                if(Yii::app()->request->isPostRequest) {


                $redirectParams = array();

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

                    $redirectParams['regions'] = $_POST['regions'];

                }

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

                    $redirectParams['medics'] = $_POST['medics'];

                }




                $this->redirect(array_merge(array('searchResult'), $redirectParams));


            }


....

and use GET

...

                 $criteria_user = new CDbCriteria;


	 	 $criteria_user->condition='username like'  . ' "%' . $_GET['medics'] . '%"' .

                ' AND '	. 'city like' . ' "' . $_GET['regions'] . '"';

...



see http://www.yiiframew…os-de-busqueda/

Horacio Segura, Thank you very much.