Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get and post in cakephp

In Codeigniter I do this

$p=$this->input->post();

to get all objects posted but I don't know if there is something similar in cakephp to get all posted variables from a form ? I am writing a function to get posted password and save it into database in place of the old password recorded there.

I use native php to get 'posted' variables from a form, (I am not familiar with cakephp form usage) that is why, so instead of using $_POST['sssss'] what should I do now ?

Thank you for any help.

like image 644
OhDude Avatar asked Mar 07 '12 08:03

OhDude


People also ask

How can I get data from cakephp?

To view records of database, we first need to get hold of a table using the TableRegistry class. We can fetch the instance out of registry using get() method. The get() method will take the name of the database table as argument. Now, this new instance is used to find records from database using find() method.

What are request and response objects?

The request and response objects provide an abstraction around HTTP requests and responses. The request object in CakePHP allows you to introspect an incoming request, while the response object allows you to effortlessly create HTTP responses from your controllers.

How can I get URL parameters in cakephp 3?

Cakephp get url parameters Syntax – // Get the Passed arguments $this->request->pass; $this->request['pass']; $this->request->params['pass']; The above syntax will give you the arguments of url passed along with controller.

How can I get Cakephp url?

Get Current Url in Cakephp : $this->here is used to get the current url in cakephp. it will give you the absolute current url. $this->request->here is also used to get current url.


1 Answers

$value = $this->request->data('key');

Please for further reference, read the manual. It's so much easier and better for yourself to figure it out by yourself.

http://book.cakephp.org/2.0/en/controllers/request-response.html#accessing-post-data

like image 128
Bas Tuijnman Avatar answered Sep 16 '22 14:09

Bas Tuijnman