CodeIgniter Forums
can i access post request data in the controller? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: can i access post request data in the controller? (/showthread.php?tid=4682)



can i access post request data in the controller? - El Forum - 12-10-2007

[eluser]plainas[/eluser]
Maybe i am missing something in here.
Code:
$this->input->post("var");

is it only acessible in the views?
That's not so practical to handle forms.

I want to set the action of a post form to a controller, and then, according on the data provided, direct the user to the apropriate view.


can i access post request data in the controller? - El Forum - 12-10-2007

[eluser]gtech[/eluser]
it works in the controller also, infact I usually use it in the controllers.

so here are the steps

.you post to the controller from your view
.in the controller you retrieve the form vars using $this->input->post("var");


can i access post request data in the controller? - El Forum - 12-10-2007

[eluser]Michael Wales[/eluser]
Agreed - I never even thought to use it in a view (or how that would be useful).


can i access post request data in the controller? - El Forum - 12-10-2007

[eluser]CI Lee[/eluser]
However.... one could use that to implement a two click process to prevent spam. Display a second button to click before processing.

-Lee


can i access post request data in the controller? - El Forum - 12-12-2007

[eluser]plainas[/eluser]
I have no idea what i missed yesterday, today i can fetch post values very easily.
I should have missed a character or something. Sorry.
Thank you all.