Skip to content
Advertisement

In codeigniter i am send a php variable from view page to controller through the tag, but i can’t display value in controller page

this is my view page code

<td><a href="<?php echo site_url("Customer/viewpatient/?id=".$id); ?>" ><button type="button" name="admit" class="btn btn-danger" data-toggle="modal" id="btnViewCust">Admit</button></a></td>

this is my controller function

public function viewpatient()
{

        $data['id'] = $this->input->post('id');
        echo $data['id'];

}

Advertisement

Answer

Use this $this->input->get()

   public function viewpatient()
    {

    $data['id'] = $this->input->get('id');
    echo $data['id'];

   }
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement