Tuesday, February 11, 2014

Re: How does HTTP Post URL for adding multiple records look like?

Hi Sam

Please check the CakePHP book at this URL:
http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#field-naming-conventions

That should clarify how for example to add more than one row of data in one POST.

Kind regards
John

On Monday, 10 February 2014 10:33:48 UTC+2, Sam wrote:
Dear CakePHP gurus,

I would like to add multiple records to a single model in a single HTTP post. For single record, the HTTP post will look something like "http://127.0.0.1/app/model/api_add/data[Model][Field1]". How will the HTTP Post URL look like for adding multiple records? I will tried different sort of combination but failed.

Below is the add() in the Controller.
        public function add() 
        {             
            if ($this->request->is('post')) 
            {
                $this->Model->create();
                $this->Model->saveAll($this->request->data);
            }
        }

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: