• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using redirect to call another controller function

#1
[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

#2
[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?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.