CodeIgniter Forums
Passing data from on view to another ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Passing data from on view to another ? (/showthread.php?tid=21160)



Passing data from on view to another ? - El Forum - 08-01-2009

[eluser]HooJee[/eluser]
Hi Guys

Is it possible to set a variable in one view and forward it to another? I tried to no avail. Below is my source code:

Code:
// view1.php
<?php
    $message = "No Projects Found";
    $this->load->view('ajax/infoBox', $message);
?>

//infoBox.php
<?php echo $message; ?>

The above gives me an error that the var message cannot be foundd.


Passing data from on view to another ? - El Forum - 08-01-2009

[eluser]Dam1an[/eluser]
you always need to pass variables into a view as an array, try
Code:
$this->load->view('ajax/infoBox', array('message'=>$message));