codeigniter get value from url
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
codeigniter url
add a comment |
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
codeigniter url
what is your controller name? and What value do you intend to receive?
– DhruvPathak
Mar 12 '12 at 11:49
sorry,my controller name is "c_service" and "get_radius" is a function in controller..i need to recieve the value 123 inside the function "get_radius"
– youv
Mar 12 '12 at 11:53
No need to -1 this question.
– StackOverflowed
Oct 19 '12 at 3:27
add a comment |
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
codeigniter url
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
codeigniter url
codeigniter url
edited Mar 12 '12 at 11:56
asked Mar 12 '12 at 11:46
youv
35117
35117
what is your controller name? and What value do you intend to receive?
– DhruvPathak
Mar 12 '12 at 11:49
sorry,my controller name is "c_service" and "get_radius" is a function in controller..i need to recieve the value 123 inside the function "get_radius"
– youv
Mar 12 '12 at 11:53
No need to -1 this question.
– StackOverflowed
Oct 19 '12 at 3:27
add a comment |
what is your controller name? and What value do you intend to receive?
– DhruvPathak
Mar 12 '12 at 11:49
sorry,my controller name is "c_service" and "get_radius" is a function in controller..i need to recieve the value 123 inside the function "get_radius"
– youv
Mar 12 '12 at 11:53
No need to -1 this question.
– StackOverflowed
Oct 19 '12 at 3:27
what is your controller name? and What value do you intend to receive?
– DhruvPathak
Mar 12 '12 at 11:49
what is your controller name? and What value do you intend to receive?
– DhruvPathak
Mar 12 '12 at 11:49
sorry,my controller name is "c_service" and "get_radius" is a function in controller..i need to recieve the value 123 inside the function "get_radius"
– youv
Mar 12 '12 at 11:53
sorry,my controller name is "c_service" and "get_radius" is a function in controller..i need to recieve the value 123 inside the function "get_radius"
– youv
Mar 12 '12 at 11:53
No need to -1 this question.
– StackOverflowed
Oct 19 '12 at 3:27
No need to -1 this question.
– StackOverflowed
Oct 19 '12 at 3:27
add a comment |
4 Answers
4
active
oldest
votes
In Codeigniter you can simply do
public function get_radius($lang)
var_dump($lang); //will output "lang=123"
So your link could be simplified to http://localhost/directory/c_service/get_radius/123
if you don't want to do something like explode('=', $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)
for http://localhost/directory/c_service/get_radius/123/other
add a comment |
You can use:
<?php
$this->input->get('lang', TRUE);
?>
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.
add a comment |
enable url helper in config/autoload.php
$autoload['helper'] = array('url');
or load url helper in desired controller or its method
$this->load->helper('url');
and then use below in controller
$this->uri->segment(3);
the above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
will get you second and so on.
hope this helps you
add a comment |
I manage it and i check it thats working
first load the url
$this->load->helper('url');
$this->uri->segment(3);
example : http://localhost/schoolmanagement/student/studentviewlist/541
if you use $this->uri->segment(3);
you get (541) id
The above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9666433%2fcodeigniter-get-value-from-url%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
In Codeigniter you can simply do
public function get_radius($lang)
var_dump($lang); //will output "lang=123"
So your link could be simplified to http://localhost/directory/c_service/get_radius/123
if you don't want to do something like explode('=', $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)
for http://localhost/directory/c_service/get_radius/123/other
add a comment |
In Codeigniter you can simply do
public function get_radius($lang)
var_dump($lang); //will output "lang=123"
So your link could be simplified to http://localhost/directory/c_service/get_radius/123
if you don't want to do something like explode('=', $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)
for http://localhost/directory/c_service/get_radius/123/other
add a comment |
In Codeigniter you can simply do
public function get_radius($lang)
var_dump($lang); //will output "lang=123"
So your link could be simplified to http://localhost/directory/c_service/get_radius/123
if you don't want to do something like explode('=', $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)
for http://localhost/directory/c_service/get_radius/123/other
In Codeigniter you can simply do
public function get_radius($lang)
var_dump($lang); //will output "lang=123"
So your link could be simplified to http://localhost/directory/c_service/get_radius/123
if you don't want to do something like explode('=', $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)
for http://localhost/directory/c_service/get_radius/123/other
answered Mar 12 '12 at 12:27
danneth
2,11311628
2,11311628
add a comment |
add a comment |
You can use:
<?php
$this->input->get('lang', TRUE);
?>
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.
add a comment |
You can use:
<?php
$this->input->get('lang', TRUE);
?>
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.
add a comment |
You can use:
<?php
$this->input->get('lang', TRUE);
?>
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.
You can use:
<?php
$this->input->get('lang', TRUE);
?>
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.
edited Nov 12 at 10:07
Manu K M
531314
531314
answered Mar 12 '12 at 11:53
Robert Stanley
2,32911220
2,32911220
add a comment |
add a comment |
enable url helper in config/autoload.php
$autoload['helper'] = array('url');
or load url helper in desired controller or its method
$this->load->helper('url');
and then use below in controller
$this->uri->segment(3);
the above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
will get you second and so on.
hope this helps you
add a comment |
enable url helper in config/autoload.php
$autoload['helper'] = array('url');
or load url helper in desired controller or its method
$this->load->helper('url');
and then use below in controller
$this->uri->segment(3);
the above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
will get you second and so on.
hope this helps you
add a comment |
enable url helper in config/autoload.php
$autoload['helper'] = array('url');
or load url helper in desired controller or its method
$this->load->helper('url');
and then use below in controller
$this->uri->segment(3);
the above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
will get you second and so on.
hope this helps you
enable url helper in config/autoload.php
$autoload['helper'] = array('url');
or load url helper in desired controller or its method
$this->load->helper('url');
and then use below in controller
$this->uri->segment(3);
the above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
will get you second and so on.
hope this helps you
answered Mar 12 '12 at 11:54
Junaid
1,71311430
1,71311430
add a comment |
add a comment |
I manage it and i check it thats working
first load the url
$this->load->helper('url');
$this->uri->segment(3);
example : http://localhost/schoolmanagement/student/studentviewlist/541
if you use $this->uri->segment(3);
you get (541) id
The above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
add a comment |
I manage it and i check it thats working
first load the url
$this->load->helper('url');
$this->uri->segment(3);
example : http://localhost/schoolmanagement/student/studentviewlist/541
if you use $this->uri->segment(3);
you get (541) id
The above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
add a comment |
I manage it and i check it thats working
first load the url
$this->load->helper('url');
$this->uri->segment(3);
example : http://localhost/schoolmanagement/student/studentviewlist/541
if you use $this->uri->segment(3);
you get (541) id
The above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
I manage it and i check it thats working
first load the url
$this->load->helper('url');
$this->uri->segment(3);
example : http://localhost/schoolmanagement/student/studentviewlist/541
if you use $this->uri->segment(3);
you get (541) id
The above line will get you the first parameter, increasing value will get you parameters
$this->uri->segment(4);
edited Oct 17 '16 at 10:37
SHAZ
2,34661727
2,34661727
answered May 4 '15 at 10:40
Md.Jewel Mia
1,5041316
1,5041316
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9666433%2fcodeigniter-get-value-from-url%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what is your controller name? and What value do you intend to receive?
– DhruvPathak
Mar 12 '12 at 11:49
sorry,my controller name is "c_service" and "get_radius" is a function in controller..i need to recieve the value 123 inside the function "get_radius"
– youv
Mar 12 '12 at 11:53
No need to -1 this question.
– StackOverflowed
Oct 19 '12 at 3:27