Hi all. I can't figure out why my application keeps on adding new records when I edit a certain record.
here's my edit method in controller: function edit($id = null) { if (empty($this->data)){ $this->Event->id = $id; $this->data = $this->Event->read(); $this->set('categories', $this->Category->find('list')); if (empty($this->data['Event']['name'])) { $this->Session->setFlash('Invalid Event ID.'); $this->redirect(array('action'=>'calendar'), null, true); } } else{ $clean = new Sanitize(); $this->data['Event']['name'] = $clean->html($this->data['Event'] ['name']); $this->data['Event']['desc'] = $clean->html($this->data['Event'] ['desc']); $this->data['Event']['user_id'] = 41; if ($this->Event->save($this->data)) { $this->Session->setFlash(__('Event updated.', true)); $this->redirect(array('action'=>'calendar'), null, true); exit(); } else { $this->Session->setFlash('The Event could not be saved. Please, try again.'); } } } edit.ctp: <?php echo $form->create('Event', array('type'=>'file', 'url' => array ('controller' => 'events', 'action' => 'edit'))); echo $form->input('Event.name', array('label'=>'Event')); echo 'Details<br/>'.$form->textarea('Event.desc'); echo $form->input('keywords'); echo $form->input('Event.category_id', array('type'=>'select', 'options'=>$categories, 'empty'=> '--select category--','label'=>'Categories')); echo $form->input('Event.venue', array('type'=>'text', 'label'=>'Venue')); echo $form->input('Event.start_date', array('type'=>'text', 'label'=>'Start Date')); echo $form->input('Event.end_date', array('type'=>'text', 'label'=>'End Date')); echo '<label>Image</label>'.$form->file('Image', array ('label'=>'Image')); // echo '<br/><br/><label>Video</label>'.$form->file('videoFile', array('label'=>'Video')); echo $form->end('Update Event'); ?> </div> It really gives me head ache so please help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---