Reputation: 571
Using CakePHP3, I have a search form with GET
method. Trying to get the URL parameter seems not to work. I doing as follow :
if(isset($this->request->params['text'])){
// the code ...
}
The search form's action has a defined route :
$routes->connect('/search', [
'controller' => 'Top',
'action' => 'index'
],
[
'_name' => 'search'
]);
How to fix this ?
Upvotes: 0
Views: 976
Reputation: 1240
I think you are looking for this:
$this->request->query('text');
Reference: http://book.cakephp.org/3.0/en/controllers/request-response.html#query-string-parameters
Upvotes: 1
Reputation: 8496
You can do something like this fo fetch querystring($_GET) parameters
if(isset($this->request->query['text'])){
// the code ...
}
Upvotes: 1