CodeIgniter Forums
how to put dynamic info in an array? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: how to put dynamic info in an array? (/showthread.php?tid=26349)

Pages: 1 2 3 4


how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]dadamssg[/eluser]
Im trying to put dynamic info in an array. Im setting a session variable to hold which page the user is on so if they login they will be redirected to the page they were on...this isn't working
Code:
$eventid = $row->eventid;
        $newdata = array(
                   'page'  => "event/index/$eventid",
               );
        $this->session->set_userdata($newdata);



how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]WebsiteDuck[/eluser]
Take out the comma at the end of this line
Code:
'page'  => "event/index/$eventid",



how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]dadamssg[/eluser]
just tried it...still not working


how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]WebsiteDuck[/eluser]
Make sure $eventid contains data... make sure session library is loaded

What happens when you try to retrieve the page from session?


how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]saidai jagan[/eluser]
Code:
echo $eventid = $row->eventid;
what it returns ?


how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]dadamssg[/eluser]
hmmm its returning the right content. It will hold "event/index/867". But i can't seem to to get it to work in a redirect.

heres the redirect its being used in...in another controller
Code:
$page = $this->session->userdata('page');
                    redirect("$page");



how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]JHackamack[/eluser]
try passing in a second param like:
redirect($page, 'refresh');

or
redirect($page, 'location');


how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]dadamssg[/eluser]
nope, still nothing. im thinkin about using the normal PHP header() function


how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]dadamssg[/eluser]
welp, the header() won't work either...wtf.

this is working, where mains is a controller and performance is a function
Code:
$newdata = array(
                   'page'  => 'mains/performance',
               );
        $this->session->set_userdata($newdata);
however this isn't, event is a controller and $eventid is holding a number because im echoing it out onto the page
Code:
$page = "event/index/".$eventid;
        $newdata = array(
                   'page'  => $page,
               );
        $this->session->set_userdata($newdata);



how to put dynamic info in an array? - El Forum - 01-11-2010

[eluser]JHackamack[/eluser]
One other thing to check: Are you loading the URL helper?