Zubair Saif
Zubair Saif

Reputation: 1247

How to Resolve Page Redirect issue in Codeigniter

When I click on href the dashboard page is loaded but the the location on the href is a different page.

<li><a href="<?php echo base_url() ?>folder/controller/function">Add supplier</a></li>

Controller

public function add_supplier($id = null)
    {
        $this->tbl_supplier('supplier_id');

        if ($id) {//condition check
            $result = $this->global_model->get_by(array('supplier_id' => $id), true);

            if ($result) {
                $data['supplier'] = $result;
            } else {
                //msg
                $type = 'error';
                $message = 'Sorry, No Record Found!';
                set_message($type, $message);
                redirect('admin/purchase/manage_supplier');
            }
        }

        // view page
        $data['title'] = 'Add New Supplier';
        //$data['editor'] = $this->data;
        $data['subview'] = $this->load->view('admin/purchase/add_supplier', $data, true);
        $this->load->view('admin/_layout_main', $data);
    }

Upvotes: 0

Views: 75

Answers (1)

nexthor1978
nexthor1978

Reputation: 55

have you tried to do this:

<li><a href="<?php echo site_url("folder/controller/function") ?>">Add supplier</a></li>

Passing the path into the site_url() helper function will return the correct path what are you looking for.

Upvotes: 1

Related Questions