I have a general controller which will get the POST
request and decide to call known method of any controller. The controller will be chosen according to request.
Also I need to send whole POST
request to chosen method without tampering.
More Description
Getting post request in controller 1
, handling the request and decide to call known_method()
of controller X | X != 1
. Also sending primary request to the method. E.g.
public function index()
{
$post = $this->input->post();
//handling the request and decide to call the following method of another controller
Controller_X->known_method($post);
//OR
redirect("site_url/controller_X/known_method/{$post}");
}
But because sending $post
as parameter as it will send as GET
request, may tamper it's data, it's not practical way. Also storing in session
and retrieve that in target method is not a good solution.
Question: How I can send this data to my selected target?
Thanks in advance
well you can just include the controller inside a controller
if(toIncludeController_a()){
$this->load->library('../controllers/Controller_a');
$this->controller_a->myFunction(); //<- this function can also get the post data using $this->input->post
}
contoller_a:
public function myFunction(){
$data = $this->input->post();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With