I need to call a method in controller from tag while passing parameter,here is the code.When I click the link I need to call that function in model,
**controller**
public function company_details($id){
$this->load->view('view_header');
$this->load->view('view_nav');
$this->load->model('company_detail_model');
$data['company_result'] = $this->load->company_detail_model->getRecords();
$this->load->view('company_details',$data);
$this->load->view('view_footer');
}
model
class Company_detail_model extends CI_Model{
function getRecords()
{
$this->load->database();
$q = $this->db->get("companydetails");
if($q->num_rows() > 0)
{
return $q->result();
}
return array();
}
}
view
<label for="folder1"><a href="<?php echo site_url('site2/company_details'.$row->id); ?>"><?=$row->name?></label></a>
I need to display these data in text input form like this,
<?php echo form_open_multipart('site/upload');?>
<label>Code : </label> <?php echo form_input('code');?><br/><br/>
<label>Name : </label> <?php echo form_input('name');?><br/><br/>
<label>Logo : </label><input type="file" name="userfile"/><br/><br/>
<label>URL : </label> <?php echo form_input('url');?><br/><br/>
<label>Description : </label> <textarea name="description" rows="4" cols="50"></textarea><br/><br/>
<input type="submit" name="submit" value="Save"/>
</form>