CodeIgniter Forums
passing value from view to controller to model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: passing value from view to controller to model (/showthread.php?tid=27441)



passing value from view to controller to model - El Forum - 02-10-2010

[eluser]new kid[/eluser]
i want to pass a single value from view through href to a function in controller and from there to model how ??

please help


passing value from view to controller to model - El Forum - 02-10-2010

[eluser]SpooF[/eluser]
Code:
http://localhost/index.php/controller/method/value
Code:
class controller extends Controller
{
    function controller()
    {
         parent::Controller();
         $this->load->model('model');
    }

    function method($var)
    {
         $this->model->method($var);
    }
}

Not quite sure exactly what your asking.


passing value from view to controller to model - El Forum - 02-10-2010

[eluser]new kid[/eluser]
thanks and how to get this in model


passing value from view to controller to model - El Forum - 02-11-2010

[eluser]new kid[/eluser]
wat i want to do is pass a value through href to a function in controller and pass it to model from there

ineed the value in the model to use in select

from

where'value'


help please


passing value from view to controller to model - El Forum - 02-11-2010

[eluser]SpooF[/eluser]
You can pass variables to the functions in your model the same way you do any other function.


passing value from view to controller to model - El Forum - 02-11-2010

[eluser]Colin Williams[/eluser]
new kid probably doesn't know how functions work.


passing value from view to controller to model - El Forum - 02-11-2010

[eluser]daparky[/eluser]
This should help you: http://ellislab.com/codeigniter/user-guide/general/routing.html