[SOLVED] double $_GET param

Hello everybody,

in SiteController index action I’ve this code:

public function actionIndex()

{


    $result = null;


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


        $result = app()->mycomp->findObjects(array('terms'=>$_GET['q'], 'title'=>'true'));


    }





	$this->render('index', array('result'=>$result));


}

In index.php I’ve a simple form with 1 input text to submit query string.

If I submit twice I’ve this url

/index.php/site/index?q=home&q=bar

How to remove clear params on new submit?

thanks


unset($_GET['q']);

Specify the action in your form.

If you are using CHtml::… do this

echo


CHtml::beginForm(array('/controller/action'));

or




<form action="<?php echo Yii::app()->createUrl('/controller/action'); ?>" method="get">



if you are using html markup

thanks. With widget I added action param:

<?php $form=$this->beginWidget(‘CActiveForm’, array(

'id'=&gt;'search-form',


'enableAjaxValidation'=&gt;false,


'method'=&gt;'get',


'action'=&gt;'index'

));

?>