Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] $this->session->userdata(); as an array()
#1

[eluser]Bart v B[/eluser]
Hi all,

i have a piece of code that wil store dynamic the values from forms into a CI session.

That works:
Code:
<?php
$data = array();
        $i = 0;        
        foreach($_POST as $key => $value)
        {
          $i++;
          $data[$key] = $value;
        }
        
        $this->session->set_userdata($data);

normaly when you read it out like this: echo $this->session->userdata('voornaam');
But now i don't know what data is stored in the session.
So how do i get the values dynamic?
#2

[eluser]WanWizard[/eluser]
Either store the array with a specific key and retrieve the entire array
Code:
$this->session->userdata( array('postvalues' => $data) );
or write a session extension with a method that allows you to iterate over the internal userdata array.
#3

[eluser]Bart v B[/eluser]
Thnx Wanwizard!

The problem is solved.
Sometimes it can be that simple.




Theme © iAndrew 2016 - Forum software by © MyBB