سؤال

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?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top