Convert form GET method query data to named parameter in cakephp

Hi, I have shared simple logic to convert the form data(GET method query string)  into named parameters in CakePHP.

Consider this simple form

This is a simple form with GET method to search the blog based on the keyword.A simple function to convert the query string to named parameters.

Argument $param_names is the form field names.So you can pass the multiple fileds but i have use single field in this example.Then, you must assign that function with single or multiple form fields at beginning of the form action method.I mean ,your form action is blogs/index means then you must declare this function at beginning of the blogs index method.

Example: $this->convertGetQueryString2named(array(‘q’));

Complete Controller code is here

I hope this is more use full for the CakePHP developer.