Welcome Guest, Not a member yet? Register   Sign In
using sessions from one function to another
#2

[eluser]gtech[/eluser]
have you tried

Code:
$this->session->set_userdata(array('foo'=>$captcha['word']));

[strike]as I believe set_userdata takes an associative array. [/strike]
[edit]actually your method should work after reading the user guide[/edit]

what I would do is create a simple test controller

Code:
<?php
class Temp extends Controller {

  function Temp()
  {
    parent::Controller();
    $this->load->library('session');
  }
  function index()
  {
    $this->session->set_userdata('testkey','testvalue');
    echo 'set session';
  }
  function getsess() {
    echo $this->session->userdata('testkey');
  }
}
?>

the above code worked for me, you could browse to

http://<ciinstall>/index.php/temp
and then
http://<ciinstall>/index.php/temp/getsess

you should see 'testvalue' echoed to the browser.. if not then I suggest turning the log threashold on in your config and see if you are getting any errors.


Messages In This Thread
using sessions from one function to another - by El Forum - 05-21-2008, 01:02 AM
using sessions from one function to another - by El Forum - 05-21-2008, 05:55 AM
using sessions from one function to another - by El Forum - 05-21-2008, 08:07 AM
using sessions from one function to another - by El Forum - 05-21-2008, 08:45 AM
using sessions from one function to another - by El Forum - 05-21-2008, 09:50 AM
using sessions from one function to another - by El Forum - 05-21-2008, 10:06 AM
using sessions from one function to another - by El Forum - 05-21-2008, 10:15 AM
using sessions from one function to another - by El Forum - 05-21-2008, 10:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB