0

I would like to get variable available from a view file to another view after loading it in Codeigniter. Suppose, I have a code snippet in a view file name example.php

$test = 'test'

And I load this view file in test.php like this

$this->load->view('example.php') after this in test.php I would like to get the value of the variable $test in test.php view file

1
  • try ajax to do that Commented Jan 2, 2020 at 7:27

2 Answers 2

1

I have able to resolve the issues using $GLOBALS

Sign up to request clarification or add additional context in comments.

Comments

0

Just pass

$data = ['test' => $test];

to like

$this->load->view('example.php', $data);

1 Comment

The same we we passed data to example.php we have to pass data to test.php

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.