CodeIgniter Forums

Full Version: question about redirect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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

Can I send data with redirect.

If yes, how?

El Forum

[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

El Forum

[eluser]Hitesh Chavda[/eluser]
Thanks man

El Forum

[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!!!!

El Forum

[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

El Forum

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

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