codeigniter url parameter interchange -


my current url http://localhost/ci/test_test/test/12/abc

12 id , abc value passed in function test

now want url http://localhost/ci/test_test/test/id/12/val/abc function may know after id keyword id , after value keyword value

public function test($id="",$code=""){           $data['id']=$id;          $data['code']=$code;  		$this->load->view('welcome_message',$data);  	}

in routes.php , set url :

$route['test_test/test/id/(:num)/val/(:any)'] = "path/to/your_controller/$1/$2"; 

and controller :

public function your_controller($id="",$val){     //... } 

Comments