'customer' is not an HTTP method, maybe you are confusing the is('post') as 
if it were a Post model and not a POST request. Just change that if to:

 if($this->request->is('post')) {

On Wednesday, August 6, 2014 12:19:56 PM UTC+2, Jovan Chee Nanić wrote:
>
> I have to do one page web application in cakePHP. I have template where 
> are put all divs and from jQuery then show or hidden appropriate div. I 
> have two div with forms to store some data in db. I crated elements for my 
> div-s, and then in my layout, in each div i put <br/>
>
> < ? php echo $this->element('register'); ?>
>
> I created form in element, a same way in view.
>
>    
>  <?php $customers = $this->requestAction('customers/add'); ?>
>     
>     <div class="customers form">
>     <?php echo $this->Form->create('Customer'); ?>
>     
>         
>         
>         <?php
>             echo $this->Form->input('salutation', array(
>                         'options' => array('Mr' => 'Mr', 'Mrs' => 'Mrs', 
> 'Ms' => 'Ms')
>                     ));
>             echo $this->Form->input('firstname', array('required' => true
> ));
>                     echo $this->Form->input('lastname', array('required' 
> => true));
>             echo $this->Form->input('street', array('required' => true));
>                     echo $this->Form->input('zip_city', array('required' 
> => true));
>                     echo $this->Form->input('country', array('required' => 
> true));
>                     echo $this->Form->input('phone', array('required' => 
> true));
>                     echo $this->Form->input('email', array('required' => 
> true));
>         ?>
>         <?php echo $this->Form->end($options); ?>
>         
>     </div>
>
>
>
> My controller for adding data in db:
>
>     
> public function add(){        
>             if($this->request->is('customer')) {
>                 $this->Customer->create();
>                 if($this->Customer->save($this->request->data)){
>                     $this->Session->setFlash('Register successiful');
>                 }
>                 $this->Session->setFlash('Unable to register!');
>             }
>         }
>
>
>
> I think that is my problem in this line: 
>
>     if($this->request->is('customer')) {
>
>
>
> If I remove if-statement, I succedd to store data in table, but stored and 
> more blank rows.
>
> I appreciate every suggestion. Thanks
>

-- 
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+unsubscr...@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/d/optout.

Reply via email to