Thursday, October 2, 2014

Re: cant add a new row in a table from an existing table

Switch on debug and check the error messages.

rrd

2014-10-02 16:00 GMT+02:00 ajt <jagguy999@gmail.com>:
Hi , I just want to add a new row of a table from a form of an exisitng table row.
The issue is I can get the data from the existing table called Tutor but I cant save this data and other fileds I need to ass to the new table called TutorEdie

public function tutor_edit($id = null) {          $this->loadModel('Tutor');            $this->Tutor->id = $id;            debug($this->request->data );            if (!$this->Tutor->exists()) {              throw new NotFoundException(__('Invalid tutor'));          }          if ($this->request->is('post')  ) {  ///New fields need to be added before saving

 
if ($this->TutorEdit->save($this->request->data)) { $this->Session->setFlash(__('The tutor details to be edited have ben forwarded to management'), 'flash_success'); // $this->redirect(array('controller'=> 'tutors' , 'action' => 'tutordetails')); } else { $this->Session->setFlash(__('The tutor edit details could not be saved. Please, try again.'), 'flash_alert'); } } else { $this->request->data = $this->Tutor->read(null, $id); } ///// <?php echo $this->Form->create('Tutor',array('class' => 'form-horizontal')); echo $this->Form->input('id', $formHorizontalHtmlOptions); echo $this->Form->input('first_name', $formHorizontalHtmlOptions); echo $this->Form->input('last_name', $formHorizontalHtmlOptions); echo $this->Form->input('email', $formHorizontalHtmlOptions); echo $this->Form->input('mobile', $formHorizontalHtmlOptions);

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

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

No comments: