I have a search form on my index page.
<form action="<?=$this->createUrl(array('search/result'))?>" method="POST">
<div>
<input type="text" name="search">
</div>
Now it’s creating this HTML code :
<form action="/project/index.php?r=search/result" method="POST">
<div>
<input type="text" name="search">
</div>
And this is result action of Search.
public function actionSonuc()
{
$criteria = new CDbCriteria;
$criteria->condition = "`name` LIKE '%".$_POST["search"]."%'";
$query = Otel::model()->findAll($criteria);
$this->render('result', array("query" => $query));
}
Everything is OK. BUT as you see, it’s using POST for submitting form datas. I want to use GET. When i use GET instead of POST like this
<form action="/project/index.php?r=search/result" method="GET">
<div>
<input type="text" name="search">
</div>
It’s sending form to this URL
http://domain.com/project/?search=test
instead of this :
http://domain.com/project/?r=search/result&search=test
It’s ignoring r=search querystring on action.
ADDITIONAL :
Yes i can put this to my form, to solve problem
<input type="hidden" name="r" value="search/result">
But what will happend if i change URL format with urlManager ? i mean i can change index.php?r=search/result to index.php/search/result . This time, that method won’t work.