控制器創建UserController.php蛋糕PHP數據不保存到數據庫表
public function myappointment() {
$this->loadmodel('event');
if ($this->request->is('post')) {
$this->Event->create();
if ($this->Event->save($this->request->data)) {
$this->Session->setFlash(__('Your appointment has been saved.'));
} else {
$this->Session->setFlash(__('Unable to add your appointment.'));
}
}
}
型號名稱事件鑑於 event.php
class Event extends UserMgmtAppModel {
}
約會表單代碼
<?php
$this->Form->create('Event');
echo $this->Form->input("title" ,array('label' => false));
echo $this->Form->input("from", array('label' =>false, 'type' => 'text', 'class' => 'fl tal vat w300p', 'error' => false , 'id' => 'select_date'));
echo $this->Html->div('datepicker_img w100p fl pl460p pa', $this->Html->image('calendar.png'),array('id' => 'datepicker_img')); ?>
<?php echo $this->Html->div('datepicker fl pl460p pa', ' ' ,array('id' => 'datepicker'));
echo 'End time';
echo $this->Form->input("to", array('label' =>false, 'type' => 'text', 'class' => 'fl tal vat w300p', 'error' => false , 'id' => 'select_date1'));
echo $this->Html->div('datepicker_img1 w100p fl pl460p pa', $this->Html->image('calendar.png'),array('id' => 'datepicker_img1')); ?>
<?php echo $this->Html->div('datepicker1 fl pl460p pa', ' ' ,array('id' => 'datepicker1'));
echo $this->Form->end('Create appointment');
u能請告訴我如何插入值到數據庫中。我們需要一個步驟來創建控制器,型號,CTP文件 – vijay
'類的事件擴展UserMgmtAppModel {'你確定嗎? –
是類創建像 – vijay