I'm trying to write a code where I use this particular line of code to store my post values in a session array
$this->session->set_userdata('newdata', $newdata);
The problem is, I can not seem to echo out the values inside it.
This is how I echo them out:
<?php echo $this->session->userdata('suffix'); ?>
Is there another way to echo out sessions?
Thanks in advance!
Use this
$session_data = $this->session->all_userdata();
echo '<pre>';
print_r($session_data);
If you set data like this:
$this->session->set_userdata('newdata', $newdata);
You will need to access it like this:
$this->session->userdata('newdata');
So you could do:
// dump all content
var_dump($this->session->userdata('newdata'));
// or access array indexes like so.
$post_array = $this->session->userdata('newdata');
echo $post_array['index'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With