CodeIgniter Forums

Full Version: Question: SESSION and ARRAY
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hello all,

i have a questen to SESSION and ARRAY with CI. I should like to use array in session. Here example use without CI.

$_SESSION['name'][$_POST['title']] = array($_POST['description'], $_POST['number_of'], $_POST['place']);

This work good Smile.

The example with CI.

$Name['Name'][$this->input->post('title')] = array($this->input->post('description'), $this->input->post('number_of'), $this->input->post('place'));

This doesn´t work.
I am overwride the old content.

El Forum

[eluser]Michael Wales[/eluser]
No testing involved, just off the top of head.
$sess_data = array(
  $this->input->post('title') => array(

Theoretically, when you retrieved this session variable it would be an array (although you'll need to know what the title is):
list($description, $number_of, $place) = $this->session->userdata('this_is_the_title');

El Forum

thanks for the fast answer. I don´t mean it.

here the array with the normal session

Array ( [Donut] => Array ( [0] => I like it [1] => 5 [2] => 1 ) [Football] => Array ( [0] => i like it realy [1] => 1 [2] => 2 ) [Notebook] => Array ( [0] => 3 GHz 160 GB [1] => 1 [2] => 3 ) )

i want speak one variable and this is inside the one variable.
i want give this with foreach back.....

here is the example without CI

foreach ($_SESSION['Name'] as $key => $index){
    echo $key.'<br />';
    foreach ($index as $value){
     echo $value.'<br />';