Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I get post data in Kohana 3 controller?

I've got a view with a form, so when user submits it - could anyone give me a link or a simple example of code Documentation and tutorials for Kohana 3 are so poor against CI .

like image 461
shershen Avatar asked Mar 01 '11 21:03

shershen


2 Answers

In Kohana 3.1 you should use Request->post():

Request::current()->post()

or if in your controller:

$this->request->post()

Since Kohana is HMVC, you can call sub-requests with dedicated post data, so using the superglobal $_POST is discouraged, since it's not unique to the request.

like image 118
zombor Avatar answered Nov 14 '22 01:11

zombor


Another way to access post data in Kohana

$username = Arr::get($_POST, 'username', 'default_username');
like image 20
Gerry Shaw Avatar answered Nov 14 '22 02:11

Gerry Shaw