php - To load controller using codeigniter

450

In the below codeigniter code i placed the controller.But it is not loading the controller.But it shows The page you requested was not found.Pls help me to solve the issue.

class User extends CI_Controller {

        public function __construct() {
                parent::__construct();
                $this -> load -> model('country_model');

        }


        function Register() {
                $data['countries'] = $this -> country_model -> get_countries();
                $this -> load -> view('test/post_view', $data);
        }
       }
840

Answer

Solution:

class User extends CI_Controller {

        public function __construct() {
                parent::__construct();
                $this->load->model('country_model');

        }


        public function Register() {
                $data['countries'] = $this->country_model->get_countries();
                $this->load->view('test/post_view', $data);
        }
       }

The parameters that come behind index.php in your url means the following.. index.php/user/register = go to the controllers user and activate the function register.

People are also looking for solutions to the problem: javascript - How can I insert ternary operation in 4th parameter in form_dropdown function in codeigniter?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.