0

I got this strange error https://i.sstatic.net/ZeYVM.png

my hello.php in my controller

<?php

class Hello extends CI_controller {

    public function one($name){
        $this->load->view('one');
        $data = array("name" => $name);
    }
}

and this is my view one.php

<?php 

echo $name;

?>
1

1 Answer 1

2

You aren't passing your $data array to your view file. Just setting $data to an array won't do anything.

public function one($name){
    $data = array("name" => $name);
    $this->load->view('one', $data);
}

DOCS: https://ellislab.com/codeigniter/user-guide/general/views.html

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

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.