0

I have two views view1.php and view2.php in CodeIgniter and I have included view2.php in view1.php and I want to use the value of variable $user_update in view2.php which I have defined in view1.php.

How can I do that?

1
  • Just pass it to the view as you'd do in a controller Commented Jan 31, 2012 at 12:47

2 Answers 2

1

If you are loading view2 within view1.. you can use the following code.

Within view1.php:

$this->load->view('view2', array('your_variable' => $your_variable));
Sign up to request clarification or add additional context in comments.

Comments

1

You would use a loader.

$this->load->vars($array);

http://codeigniter.com/user_guide/libraries/loader.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.