-1

i Want to get all these variables at one place so that i can add them into DB using a model. Thank you in advance.

          public function web_login()
    {
            $data['user'] = array();

            if ($this->facebook->is_authenticated())
            {

                $user = $this->facebook->request('get', '/me?fields=id,name,email');
                if (!isset($user['error']))
                {
                    $data['user'] = $user; // ***WANNA PASS THIS VARIABLE FROM HERE***

                    $this->load->view('user/header');
                    $this->load->view('user/fbpass');
                    $this->load->view('user/footer');

            }
            else {
                $this->load->view('user/register');
            }
        }
}

SECOND METHOD________________________________________________

                public function getpass(){
                $this->load->model('user_model', 'auth');
                $this->load->view('user/header');
                $this->load->library('form_validation');
                $this->form_validation->set_rules('password', 'Password', 'required');
                $this->form_validation->set_rules('passwordagain', 'Password Confirmation', 'required|matches[password]');

                if ($this->form_validation->run() == FALSE)
                {
                        $this->load->view('user/fbpass');
                }
                else  
                {
                        $password=$this->input->post('password');

                       ***//WANNA GET THAT VARIABLE HERE***
                }            

        }
tereško
  • 58,060
  • 25
  • 98
  • 150

2 Answers2

0
class ClassName{
    public $var;
    function one(){
        $this->var = 'value';
    }

    function two(){
        return $this->var; // if you call function one then call function two you will get value
    }
}

but if you need to call them not the same time you can use session

$_SESSION['var'] = 'value';
hossamGamal
  • 161
  • 1
  • 10
0
class TestClass extends Controller {
    function test_mehtod($param) {
        //do something
       echo $param."<br>";
       echo "hi, you are in same controller";
    }

    function test_mehtod2() {
        //do something-else
        $this->test_mehtod("param value");
        // and we called the other method here!
    }
}
nageen nayak
  • 1,262
  • 2
  • 18
  • 28