Hello, i created a new button on my index.php wich should call a simple Controller aktion.
mit index.php looks like this :
<?php
$this->pageTitle=Yii::app()->name;
?>
<h1>Please insert a valid E-Mail adress:<i></h1>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'search-form',
)); ?>
<div class="row">
<?php echo $form->textField($model,'email') ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Submit',array('site/search','id'=>$model->email)); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
The SearchForm.php:
<?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
$this->render('result',array('model'=>$model));
}
...
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