Using redirect to call another controller function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Using redirect to call another controller function (/showthread.php?tid=54106) |
Using redirect to call another controller function - El Forum - 08-22-2012 [eluser]Lane[/eluser] I've been searching and so far I'm not sure if there is a way, but here's my situation: I have a function that loads a view in one controller. When the view submits, I need to call a function in another controller and pass 2 variables to that function. If I do something like this: Code: redirect("patients/details/".$ptype."/".$pid."/", "refresh"); The receiving function accepts 2 variables like this: Code: public function Details($type, $id) My question is this: Will the receiving function associate the encoded URI with the variables in the function call? If not, is there a better way to do this? Thanks much in advance. Lane Using redirect to call another controller function - El Forum - 08-22-2012 [eluser]jmadsen[/eluser] use a library and call the function from both controllers is another way. you can do a redirect if you want to, that code should also work. really depends a lot more on your overall app structure EDIT: just reread. "When the view submits, I need to call a function in another controller and pass 2 variables to that function." Why don't you just submit the form to the second controller function? |