CodeIgniter Forums
question about redirect - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: question about redirect (/thread-22390.html)



question about redirect - El Forum - 09-08-2009

[eluser]Hitesh Chavda[/eluser]
I have a little question.

Can I send data with redirect.

If yes, how?


question about redirect - El Forum - 09-08-2009

[eluser]Dam1an[/eluser]
Yes, and you'll most likely want to use flashdata (or normal userdata if you need it to last multiple requests)
Read all about it on the sessions page in the user guide


question about redirect - El Forum - 09-08-2009

[eluser]Hitesh Chavda[/eluser]
Thanks man


question about redirect - El Forum - 09-08-2009

[eluser]8th wonder[/eluser]
yes you can use it!!!!

before redirect just do

Code:
$_SESSION=$_POST;
redirect("example.php");

and in example.php
Code:
$_POST=$_SESSION;
$userid=$_POST['userid'];

have fun dude!!!!


question about redirect - El Forum - 09-08-2009

[eluser]Dam1an[/eluser]
[quote author="8th wonder" date="1252423602"]yes you can use it!!!!

before redirect just do

Code:
$_SESSION=$_POST;
redirect("example.php");

and in example.php
Code:
$_POST=$_SESSION;
$userid=$_POST['userid'];

have fun dude!!!![/quote]

That's a terrible idea! In the first case you've be overwritting the session array and in the second case, the post array, both of which may contain other data


question about redirect - El Forum - 09-08-2009

[eluser]Hitesh Chavda[/eluser]
True, I like to use

Code:
$this->session->set_flushdata('item','value');