1
當用戶註冊我們的頁面時,我想要一個頁面出現,一旦用戶點擊提交,它會說'感謝您註冊,請檢查您的電子郵件。'。cakephp,用戶已註冊 - 如何創建響應頁面?
,這裏是我的add函數代碼
function add(){
$this->set('title_for_layout', 'Please Login');
$this->set('stylesheet_used', 'style');
$this->set('image_used', 'eBOXLogo.jpg');
if($this->request->is('post')){
$this->User->create();
if ($this->User->save($this->request->data))
{
$this->Session->setFlash('The user has been saved');
}
else { $this->Session->setFlash('The user could not be saved. Please, try again.'); }
}
}
這裏是我的add視圖
<h2>Please enter your details</h2>
<?php
echo $this->Form->create('User', array('action'=>'add'));
echo $this->Form->input('username',array('label'=>'Username: '));
echo $this->Form->input('password',array('label'=>'Password: '));
echo $this->Form->input('password_confirmation',array('type'=>'password'));
echo $this->Form->input('email',array('label'=>'Email: '));
echo $this->Form->input('title',array('label'=>'Title: '));
echo $this->Form->input('firstname',array('label'=>'First Name: '));
echo $this->Form->input('surname',array('label'=>'Surname: '));
echo $this->Form->input('street',array('label'=>'Street Address: '));
echo $this->Form->input('city',array('label'=>'City: '));
echo $this->Form->input('state',array('label'=>'State: '));
echo $this->Form->input('country',array('label'=>'Country: '));
echo $this->Form->end('Click here to Register ');
?>
乾杯隊友,感謝您的快速回復 – user1393064