cakephpcakephp-2.0formhelper

cakephp Form helper $this->data empty


I have a problem with the Form Helper that returned $this->data keeps being empty. In my Forms before there was no problems and I cant figure out what's different here. For this Form there's not a model containing the data, its just user input for doing a search.

This is my View:

<?php
echo $this->Form->create();
echo $this->Form->input('Postleitzahl');
$options=array('10'=>10,'20'=>20);
echo $this->Form->input('Entfernung',array('type'=> 'select' , 'options'=>array(($options))));
echo $this->Form->end('Suchen');
?>

Solution

  • <?php
    
        echo $this->Form->create(null, array('type' => 'post')); # not sure if that's needed
        echo $this->Form->input('Search.Postleitzahl');
        $options=array('10'=>10,'20'=>20);
        echo $this->Form->input('Search.Entfernung',array('options'=> $options)); # seems shorter and should work
        echo $this->Form->end('Suchen');
    
    ?>
    

    The above should result into a $this->data array containing something similar to this:

    ['Search']
        ['Postleitzahl']: 102929
        ['Enfernung']: 'foobar'