Welcome Guest, Not a member yet? Register   Sign In
how to put dynamic info in an array?
#11

[eluser]dadamssg[/eluser]
yes,i just took it out and tried it...same result....
#12

[eluser]Dyllon[/eluser]
When you say it's not working what do you mean, do you get a blank page? a 404?
#13

[eluser]JHackamack[/eluser]
when you're trying to call the header() function how are you calling it?

Also make sure you aren't echoing out any other variables before calling redirect or header or else it'll fail.
#14

[eluser]dadamssg[/eluser]
i think i just can't get this to work...i think my $page variable isn't getting put into the $newdata array

Code:
$page = "mains/performance";
        $newdata = array(
                   'page'  => "$page",
               );
        $this->session->set_userdata($newdata);
#15

[eluser]JHackamack[/eluser]
Try a few things


$newdata = array('page'=>$page);

instead of wrapping $page in quotes.

Also

echo "<pre>";
print_r($newdata);
echo "</pre>";
die();
and paste the output here.
#16

[eluser]chandrajatnika[/eluser]
I suggest you to add that array value to specific session name like this:
Code:
$eventid = $row->eventid;
        $newdata = array(
                   'page'  => "event/index/$eventid",
               );
        $this->session->set_userdata('my_data',$newdata);
// to get session data
$my_data = $this->session->userdata('my_data');
echo $my_data['page'];
#17

[eluser]dadamssg[/eluser]
Array
(
[page] => event/index/867
)

that didn't work either...the page im on when im logging in is

mysite.com/event/index/867

and ive set my base url to 'http://mysite.com/'


this doesn't make any sense
#18

[eluser]JHackamack[/eluser]
so when you call redirect you're saying

redirect($newdata['page'],'location')?
#19

[eluser]dadamssg[/eluser]
i've copied and pasted this section out of one controller that uses it and works and put it into this one and it doesn't work....the thing i copied and pasted doesn't even use a variable. instead of
'page'=> $page

its

'page'=> "mains/performance"

and it still doesnt work even though later works in another controller
#20

[eluser]dadamssg[/eluser]
im using this

$page = $this->session->userdata('page');
redirect($page);




Theme © iAndrew 2016 - Forum software by © MyBB