Pass multiple variables from view to controller in nice URL


I got url like this:


I’m passing 2 variables to the controller it works ok

I’m trying to create now form which will contain 2 text fields (postcode, radius) and submit button to submit those values to the controller

but can’t to find any solution. I don’t want the Ajax it is important to have dynamic and simple clean url

public function actionIndex3($postcode,$radius)


$model=new UkPostcode('search');

$postcode_found = UkPostcode::model()->find('postcode=:postcode',




$longitude = $postcode_found->longitude;

$latitude = $postcode_found->latitude;

$lng_min = $longitude - $radius / abs(cos(deg2rad($latitude)) * 69);

$lng_max = $longitude + $radius / abs(cos(deg2rad($latitude)) * 69);

$lat_min = $latitude - ($radius / 69);

$lat_max = $latitude + ($radius / 69);	

$criteria=new CDbCriteria(array(			

		'condition' => '(longitude BETWEEN '.$lng_min.' AND '.$lng_max.') AND (latitude BETWEEN '.$lat_min.' AND '.$lat_max.')',			



	$dataProvider=new CActiveDataProvider('UkPostcode', array(










If I good understand you would like to send data from the form by post request, then catch it inside the action, right? If yes, you should make you form able to send data via POST like below:


$form = $this->beginWidget('CActiveForm', array(

	'id' => 'someid',

	'enableClientValidation' => false,

	'clientOptions' => array(

	'validateOnSubmit' => true,




<?php echo $form->labelEx($model,'field'); ?>

<?php echo $form->textField($model,'field'); ?>

<?php echo $form->error($model,'field'); ?>


<?php echo CHtml::submitButton(Yii::t('app', 'Send')); ?>            

<?php $this->endWidget(); ?>

and catch it like below:



 // do something with $_POST here


Maybe this can help you a little: