Button is not calling Controller Aktion

Hello, i created a new button on my index.php wich should call a simple Controller aktion.

mit index.php looks like this :




<h1>Please insert a valid E-Mail adress:<i></h1>

<div class="form">

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


)); ?> 

	<div class="row">

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



	<div class="row buttons">

		<?php echo CHtml::submitButton('Submit',array('site/search','id'=>$model->email)); ?>


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

</div><!-- form -->

The SearchForm.php:


class SearchForm extends CFormModel


	public $email;

	public function rules()	{

		return array(

			array('email', 'required'),


	public function search(){

	return true;



and in my SiteController.php

the aktion i whant to call:


  public function actionSearch($id) {

		 $model=new SearchForm;


		if (isset($_POST['id']))


		  	 $var = $_GET['email'];

			echo "test";


		 // display the search form




I dont get it why the Button is not calling/using the actionSearch function in my Controller.

The goal is that result.php is renderd with the correct email within the SearchForm.

Thanks in advance for any help

What is happening when you do click the submit button? In your actionSearch, try this

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

    $model->attributes = $_POST['SearchForm'];


This is the way you use Yii to populate your model fields with posted data.

If i press the button it calls the actionIndex() funktion for some reason.

    public function actionIndex()


		$model = new SearchForm;

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

		    $model->attributes = $_POST['SearchForm'];







but your code was usefull for now i will do all the stuff in the actionIndex() funktion.


Did you look at the source code to make sure the link is being created correctly?