Welcome Guest, Not a member yet? Register   Sign In
Get ID from view and send it over controller to model
#4

[eluser]Unknown[/eluser]
This is not a complete code. Just the concept.

Your view:
Code:
<?php foreach($lists as $list): ?>

// Do what you want here..
<?php echo anchor('controller_name/function_to_pass_your_id/' . $list->$id, 'Link'); ?>

<?php endforeach; ?>

Your controller:
Code:
class Controller_name extends CI_Controller
{
  function function_to_pass_your_id($id)
  {
    // call the model
    $this->load->model('model_name');
    // call the function in the model to perform logic
    $this->model_name->do_something_with_id($id);
  }
}

Your model:
Code:
class Model_name extends CI_Model
{
  function do_something_with_id($id)
  {
    // do something. maybe query the db with this id
    return $something;
  }
}


Messages In This Thread
Get ID from view and send it over controller to model - by El Forum - 03-06-2012, 11:14 AM
Get ID from view and send it over controller to model - by El Forum - 03-06-2012, 04:39 PM
Get ID from view and send it over controller to model - by El Forum - 03-06-2012, 05:16 PM
Get ID from view and send it over controller to model - by El Forum - 03-06-2012, 07:55 PM
Get ID from view and send it over controller to model - by El Forum - 03-07-2012, 07:30 AM
Get ID from view and send it over controller to model - by El Forum - 03-08-2012, 08:03 AM
Get ID from view and send it over controller to model - by El Forum - 03-08-2012, 08:16 AM
Get ID from view and send it over controller to model - by El Forum - 03-08-2012, 09:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB