In Codeigniter, I do it
$p=$this->input->post();
so that all objects are submitted, but I don’t know if there is something like this in cakephp to get all published variables from the form? I am writing a function to get the published password and save it to the database instead of the old password registered there.
I use native php to get the "posted" variables from the form (I am not familiar with the use of cakephp form), so instead of using $ _POST ['sssss], what should I do now?
Thanks for any help.
$value = $this->request->data('key');
Please consult for more information, read the manual. It is much easier and better for yourself to understand yourself.
http://book.cakephp.org/2.0/en/controllers/request-response.html#accessing-post-data
for the GET method $this->request->query['category-name']; and POST method $this->request->data
http://book.cakephp.org/2.0/en/controllers/request-response.html#accessing-querystring-parameters
Post data must be in the data to be displayed in the $ this-> request-> data.
Example:
// input field <input type="text" name="data[foo]" value="bar" /> // in your controller debug($this->request->data);
You can check if you have posted the form with
if (!empty($this->data)) { print_r($this->data); }
To check if a form has been posted, use:
if ($this->request->is('post')) { pr($this->request->data); }
If you want to get a specific table field, you can navigate like this:
if($this->data["Objetorastreavel"]["id"]){ }
It only checks the Objetorestraeval identifier if you want to select only one field and not fit the entire page.
Objetorestraeval
You can access the data in the message form using:
For CakePHP 2.x
For CakePHP 3.4.x
if ($this->request->is('post')) { pr($this->request->getData()); }
Documentation for CakePHP 3
You can use the following data to receive messages / receive data in CakePHP
For post data: $this->request->data;
$this->request->data;
To get data: $this->request->query;
$this->request->query;