CodeIgniter Forums
Pass variable in redirect - 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: Pass variable in redirect (/showthread.php?tid=48765)



Pass variable in redirect - El Forum - 01-27-2012

[eluser]limit[/eluser]
Is it possible to pass variables in a redirect? I have a callback process after a payment is made. If success I redirect to order complete and destroy the session, so cant carry the order ID via a session.

On the order complete page - I want to pass the order ID in the redirect and set it in the view.

Example: on the CI docs for the URL helper is shows something like below.

Code:
redirect('/article/13');

Would 13 be the variable passed? And if so how would I retrieve that in my view? I know I have to assign $data['order_id'] = '' in my controller, but I am wondering how I would retrieve the 13? Would that be get or would I use something like

Code:
$data['order_id'] = $this->uri->segment(2);
?





Pass variable in redirect - El Forum - 01-27-2012

[eluser]limit[/eluser]

Figured it out.

$data['order_id'] = $this->uri->segment(3); Works.