I want to pass two parameters to the default controller of Codeigniter.
Controller = Post
Function = index($parm1, $parm2)
Using the below method by setting in routes, i am able to pass only one parameter. When i pass second parameter then it display error “No page found”.
$route['(:any)'] = 'post/index/$1';
How can pass two or more than two parameters?
Advertisement
Answer
Maintain your routing rules like this:-
$route['method/(:any)/(:any)'] = 'controller/method/$1/$2'; $route['method/(:any)'] = 'controller/method/$1';