I am implementing a search functionality like this:
index.ctp
<div class="Search">
<?php
// The base url is the url where we'll pass the filter parameters
$base_url = array('controller' => 'ExpiringServices', 'action' => 'index');
echo $this->Form->create("Filter",array('url' => $base_url, 'class' => 'filter'));
// Add a basic search
echo $this->Form->input("search", array('label' => false, 'placeholder' => "Name or surname..."));
echo $this->Form->submit("Refresh");
echo $this->Form->end();
?>
</div>
ExpiringServicesController.php
$searchInput = $this->request->data['search']; //line 27
But while search works as expected I receive this error:
Notice (8): Undefined index: search [APP/Controller\ExpiringServicesController.php, line 27]
If I use debug($searchInput)
I can see that it contains the search input text. But if I use if (isset($_FILES[$this->request->data['search']]))
it won't go inside the if statement, like its not set.
How I can resolve this?