CodeIgniter Forums
Classic form, how to submit to call a controller method? - 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: Classic form, how to submit to call a controller method? (/showthread.php?tid=19426)



Classic form, how to submit to call a controller method? - El Forum - 06-07-2009

[eluser]avastreg[/eluser]
The title is a little weird Smile

I need to know if there is a best-practice/how to to handle the submit of a form with method=get to call a method of a controller.

An explanatory example:

in controller_A view i have:
Code:
<form action="/controller_B/method/" method="get">

<input name="foo" value="get_value"...

</form>

I need to reach
Code:
/controller_B/method/get_value
but with that submit i get

Code:
/controller_B/method/?foo=get_value

Is there a way to do this or i have to manage it in ajax?


Classic form, how to submit to call a controller method? - El Forum - 06-07-2009

[eluser]Dam1an[/eluser]
Is there a reason you can't use normal POST?
The only other way to set get_value is when you define the form action, although you don't know the value at that point :-S