How can i recieve the value in a controller from the following URL in codeigniter
http://localhost/directory/c_service/get_radius/lang=123
controller:
class C_service extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function get_radius()
{
i need to get the vLUE 123 here
like,
`$value=$get['lang'];`
}
Thanks
In Codeigniter you can simply do
So your link could be simplified to
http://localhost/directory/c_service/get_radius/123
if you don't want to do something likeexplode('=', $lang)
to get your value.You should however also consider adding a default value
public function get_radius($lang=0)
if the link is opened without a parameter.Adding more variables is as easy as
public function get_radius($lang, $other)
forhttp://localhost/directory/c_service/get_radius/123/other
You can use:
The TRUE is to turn on XSS filtering, which you do want turned on.
Check out https://www.codeigniter.com/user_guide/libraries/input.html for more info.
I manage it and i check it thats working first load the url
example : http://localhost/schoolmanagement/student/studentviewlist/541
if you use
$this->uri->segment(3);
you get (541) idThe above line will get you the first parameter, increasing value will get you parameters
enable url helper in config/autoload.php
or load url helper in desired controller or its method
and then use below in controller
the above line will get you the first parameter, increasing value will get you parameters
will get you second and so on.
hope this helps you