- Code: Alles auswählen
- function add() {
if (!empty($this->data)) {
$this->Contact->create();
if ($this->Contact->save($this->data)) {
$this->Session->setFlash(__('The contact has been saved', true));
//$this->redirect(array('action' => 'index'));
$this->redirect(array('controller' => 'locations', 'action' => 'view', $this->data['location_id']));
} else {
$this->Session->setFlash(__('The contact could not be saved. Please, try again.', true));
}
}
$locations = $this->Contact->Location->find('list');
$this->set(compact('locations'));
}
meine Contacs view add
- Code: Alles auswählen
- <?php echo $this->Form->create('Contact');?>
<fieldset>
<legend><?php __('Add Contact'); ?></legend>
<?php
$options = array('Herr' => 'Herr', 'Frau' => 'Frau');
echo $this->Form->radio('title', $options);
echo $this->Form->input('firstname');
echo $this->Form->input('lastname');
echo $this->Form->input('fon');
echo $this->Form->input('fax');
echo $this->Form->input('email');
echo $this->Form->input('location_id', array('type' => 'hidden', 'value' => $this->params['named']['location_id']))
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
Wo habe ich hier einen Fehler gemacht?