shavindip
shavindip

Reputation: 622

Get single data from session array - CodeIgniter

I want to get single value from the flashdata array in the view which is sent from the controller.

controller:

        $post=array(
            'author_id'=>$this->input->post('author'),
            'title'=>$this->input->post('post_title'),
            'subtitle'=>$this->input->post('post_subtitle'),          
            'post'=>$this->input->post('textarea1'), 
            'image'=>$this->upload->file_name,          
        );

        $this->session->set_flashdata('postdata',$post); 

view

<?php var_dump($this->session->flashdata('postdata'))?>   

The above gave me the following result.

array(5) { ["author_id"]=> string(1) "6" ["title"]=> string(3) "uyk" ["subtitle"]=> string(26) "Full-Stack Web Development" ["post"]=> string(1) "u" ["image"]=> string(0) "" }

How can I get only single value like title or subtitle?

Upvotes: 0

Views: 48

Answers (1)

Sherif Salah
Sherif Salah

Reputation: 2153

What about this $this->session->userdata['postdata']['title']

Upvotes: 1

Related Questions