Hello, Well maybe you are using the wrong terminology. You don't add any information from a view, you add it from a controller. How you are doing it is possible, but I use var $uses at the top of the controller to give the controller access to the models you will need. Lookup the property "uses" here: http://api.cakephp.org/class/controller/
Now you could do a $this->model->create() for both tables you want to put information into. That's fine, don't see any major issues there. What I do on http://www.countycriminal.com is set an array from the $this->data so I can send it wherever I need to. Remember that when you call $this->Model->save() you can pass an array that looks something like this: $saveArray = array(); $saveArray['Modelname']['fieldname'] = Value; So that's how you would use the save function for both models you are adding data to. Now, let's say you want to skip all that and call another controller method from a different controller. I only used it once on http://www.countycriminal.com but when I did I used $this- >requestAction('/controller/action/'); Check out the documentation here: http://api.cakephp.org/class/object#method-ObjectrequestAction Hope this helps, Chad On Dec 22, 7:10 am, Urs <[email protected]> wrote: > I have two Models: ThreesixtydegreeFeedback & > ThreesixtydegreeTechReview > > My Problem is, I want to create new entry for both > ThreesixtydegreeFeedback & ThreesixtydegreeTechReview in the 'add' > view of ThreesixtydegreeTechReview. There is no associations between > these models.. > In the 'add' View of ThreesixtydegreeTechReview, I m not able to > create a new data for ThreesixtydegreeFeedback Model. > Please Help me. I am very new to cakePHP.. > > Controller of ThreesixtydegreeTechReview: > > function add(){ > > $this->loadmodel('ThreesixtydegreeFeedback'); > $this->set('feedbacks', $feedbck); > > if (!empty($this->data)) { > $this->ThreesixtydegreeTechReview->create(); > if ($this->ThreesixtydegreeTechReview->save($this->data)) { > $this->Session->setFlash(__('The > ThreesixtydegreeTechReview has beeeen saved', true)); debug($this->data); > > // $this->redirect(array('action'=>'index')); > } else { > $this->Session->setFlash(__('The > ThreesixtydegreeTechReview could not be saved. Please, try again.', > true)); > } > > $this->ThreesixtydegreeFeedback->create(); > if ($this->ThreesixtydegreeFeedback->save($this->data)) { > $this->Session->setFlash(__('The ThreesixtydegreeFeedback > has been saved', true)); > // $this->redirect(array('action'=>'index')); > } else { > $this->Session->setFlash(__('The ThreesixtydegreeFeedback > could not be saved. Please, try again.', true)); > } > } > > } > > Am i doing right? Please guide me.. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
