How to create a CakePHP search form?

Cakephp how to create a simple search form

  • I need some help to create a simple search form with one input box. It needs to be able to send a value to a controller in the url like so: http://mysite.co.uk/properties/results?search=northampton I would like to use the cakePHP form helper, but can you include an input that doesnt relate to a column in the database?

  • Answer:

    have since found the answer to this: ///in the view:/// <div class="container"> <a href='#'><div class="search-tab active_search_tab">Property Search</div></a> <div class="col-md-12 purple search_box"> <?php echo $this->Form->create('Properties', array('type' => 'get')); echo $this->Form->input('search', array('between'=>'<label for="search" class="main_search">Search</label><br>','label'=>false)); echo $this->Form->button('Search', array('class'=>'btn btn-success')); echo $this->Form->end ?> </div> </div> //in the controller// if(isset($this->params['url']['search'])){ echo 'search text has been found'; } Fair comment burzum

Deano at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.