How to put a field value to a controller/model |
[eluser]CodeIgniterNoob[/eluser]
Hello, So I have a form in one view: Code: echo form_open('main/find/'); And I want to pass the value of name field to a controller which calls a function in one of my models: Code: function getResults($name) This is my controler: Code: function Main() How can I pass the value of name to the $name variable?
[eluser]pistolPete[/eluser]
Only use one validation library, preferable the latter (because it's newer): Code: $this->load->library('validation'); Quote:How can I pass the value of name to the $name variable?Have a look at the user guide. In your controller: Code: $name = $this->input->post('name');
[eluser]CodeIgniterNoob[/eluser]
Ok its searching and finding properly. But how come its not writing the input value into the uri string? I want it to show like this /index.php/main/find/someguysname
[eluser]pistolPete[/eluser]
[quote author="CodeIgniterNoob" date="1237242655"]But how come its not writing the input value into the uri string? I want it to show like this /index.php/main/find/someguysname[/quote] Because you are doing a POST request. Have a look at this: http://ellislab.com/forums/viewreply/547980/
[eluser]CodeIgniterNoob[/eluser]
Pete, that post helped me out alot, thank you so much. |
Welcome Guest, Not a member yet? Register Sign In |