VinceGraphic VinceGraphic - 1 year ago 66
PHP Question

How do I retrieve the value of parameter from controller to view?

These is what I have, I'm using Codeigniter MVC.


public function index() {

$sample = "call: 887-65-31";

$this->load->view('contact_view', $sample);


now how do i retrieve it on contact view page?

Answer Source

Try this:



class Example extends CI_Controller {

    public function index() {
       $viewData['sample'] = "call: 887-65-31";
       $this->load->view('contact_view', $viewData);


then echo in contact_view like below:

   echo $sample;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download