In view :states
add.ctp
<div class="states form">
<?php echo $form->create('State');?>
<fieldset>
<legend><?php __('Add State');?></legend>
<?php
echo $form->input('abbr');
echo $form->input('name');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
In Controller :
class StatesController extends AppController {
var $name = 'States';
var $helpers = array('Html', 'Form');
function add() {
if (!empty($this->data)) {
$this->State->create();
if ($this->State->save($this->data)) {
$this->Session->setFlash(__('The State has been
saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The State could
not be saved. Please,
try again.', true));
}
}
}
}
In Model :
class State extends AppModel {
var $name = 'State';
var $validate = array(
'abbr' => array('notempty'),
'name' => array('notempty')
);
}
Use this code as Above just copy paste it , and follow as it , its may
solved ur pm..I hope .
By.
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
To unsubscribe, reply using "remove me" as the subject.