Hi all! I want to perform a search on the database depending on an
input from the user.
In the view I have this snippet of code:

<table>
        <tr>
             <td>
        <?php
           echo $form->input('Title to
search:',array('id'=>'inputfilter','name'=>'input','label'=>'Title to
search'));
        ?>
         </td>

         <td class="actions" >
             <div style='margin-top:35px' >
        <?php
        echo $this->Html->link(__('Filter', true), array('action' =>
'search')
        ?>
             </div>
        </td>

        </tr>
        </table>

In the controller:

function search($title)
{
            $films = $this->Film->find('all', array('conditions' =>
array('Film.titulo_original LIKE' => '%'.$title.'%'),
                                                            "OR" =>
array ('Film.titulo_alternativo LIKE' => '%'.$title.'%'),
                                                            "OR" =>
array ('Film.titulo_alternativo2 LIKE' => '%'.$title.'%')
                                                   ));
            $this->set('films', $films);
}

The question is, how can I recovery the text that the user typed in
the input field, and pass it as a parameter of the search method in
the controller??

Thanks!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to