Reputation: 59
I want to pass a dynamic value in the URL. When hitting this URL with parameter pass this parameter one routing and call the function with this parameter. I would like:
route.php
$route['emp/(:num)/(:any)'] = 'ramelexController/employeeAttendance/$1/$a';
Controller.php
<?php
error_reporting(0);
class ramelexController extends CI_Controller
{
public function employeeAttendance($id,$char)
{
echo $id.$char;
}
}
Upvotes: 0
Views: 3105
Reputation: 2251
Slightly modify your routes.php:
$route['emp/(:num)/(:any)'] = 'ramelexController/employeeAttendance/$1/$2';
Edited: as mentioned in several comments, be aware of class naming: Controller and Class name needs to be first letter uppercase. RamelexController
in your case.
Upvotes: 4