How to receive post/get request in codeigniter
Solution 1
It's outlined in the docs here: http://ellislab.com/codeigniter/user-guide/libraries/input.html
To grab data from the get
you can use
$this->input->get('some_data', TRUE);
That looks for some_data
in the query string, and will run is through XSS filtering to clean it from possible hack attempts
There's also a handy method to check both at the same time:
$this->input->get_post('some_data', TRUE);
"This function will search through both the post and get streams for data, looking first in post, and then in get"
Solution 2
Try this if you want to post request from server
if ($this->input->server('REQUEST_METHOD') == 'POST'){}
if ($this->input->server('REQUEST_METHOD') == 'GET'){}
Piya
Im a cool gal,love coding ummm infact learning it :) Need help from every one here
Updated on June 04, 2022Comments
-
Piya almost 2 years
Im using
$this->input->post('name') ;
to get a request posted to my url.Instead of post I need to access get as well.Like in normal php its ,$_REQUEST is used.But what about in codeigniter standards,how is it possible?
-
Rakesh Sharma about 10 years$this->input->get('name') ; also show some code what you need?
-
Adarsh M Pallickal about 10 yearsthe values passed with url , you can accept as argument in controller function
-