List 蛋糕PHP下拉列表
我想知道如何为“访问控制”添加一个下拉列表,值为“staff”和“Admin”。 这是我在employee controller中的add函数List 蛋糕PHP下拉列表,list,cakephp,List,Cakephp,我想知道如何为“访问控制”添加一个下拉列表,值为“staff”和“Admin”。 这是我在employee controller中的add函数 public function add() { if ($this->request->is('post')) { $this->Employee->create(); if ($this->Employee->save($this->request
public function add() {
if ($this->request->is('post')) {
$this->Employee->create();
if ($this->Employee->save($this->request->data)) {
$this->Session->setFlash(__('The employee has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The employee could not be saved. Please, try again.'));
}
}
}
$customers = $this->Employee->modelname->find('list');
$this->set(compact('customers'));
这是添加视图代码:
<div class="employees form">
<?php echo $this->Form->create('Employee'); ?>
<fieldset>
<legend><?php echo __('Add Employee Details'); ?></legend>
<?php
echo $this->Form->input('employee_name');
echo $this->Form->input('date_hired', array('dateFormat' => 'DMY','minYear'=>date('Y')-100, 'maxYear'=>date('Y')+100));
echo $this->Form->input('employee_phone_number');
echo $this->Form->input('employee_email');
echo $this->Form->input('employee_address');
echo $this->Form->input('employee_dob', array('dateFormat' => 'DMY','minYear'=>date('Y')-100, 'maxYear'=>date('Y')+100));
echo $this->Form->input('access_level');
echo $this->Form->input('employee_username');
echo $this->Form->input('employee_pw');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
如果您正在从数据库获取访问级数据,则-
echo $this->Form->input('access_level', array('options' => array('admin' => 'Admin', 'staff' => 'Ataff')));
如果您正在从数据库获取access_级别的数据,则-
echo $this->Form->input('access_level', array('options' => array('admin' => 'Admin', 'staff' => 'Ataff')));
如果您正在从数据库获取access_级别的数据,则-
echo $this->Form->input('access_level', array('options' => array('admin' => 'Admin', 'staff' => 'Ataff')));
如果您正在从数据库获取access_级别的数据,则-
echo $this->Form->input('access_level', array('options' => array('admin' => 'Admin', 'staff' => 'Ataff')));
为
访问控制
添加下拉列表,其值为职员
和管理员
。
将其添加到员工控制器中
public function add() {
if ($this->request->is('post')) {
$this->Employee->create();
if ($this->Employee->save($this->request->data)) {
$this->Session->setFlash(__('The employee has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The employee could not be saved. Please, try again.'));
}
}
}
$customers = $this->Employee->modelname->find('list');
$this->set(compact('customers'));
并在view.ctp
echo $this->Form->input('access_level');
为
访问控制
添加下拉列表,其值为职员
和管理员
。
将其添加到员工控制器中
public function add() {
if ($this->request->is('post')) {
$this->Employee->create();
if ($this->Employee->save($this->request->data)) {
$this->Session->setFlash(__('The employee has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The employee could not be saved. Please, try again.'));
}
}
}
$customers = $this->Employee->modelname->find('list');
$this->set(compact('customers'));
并在view.ctp
echo $this->Form->input('access_level');
为
访问控制
添加下拉列表,其值为职员
和管理员
。
将其添加到员工控制器中
public function add() {
if ($this->request->is('post')) {
$this->Employee->create();
if ($this->Employee->save($this->request->data)) {
$this->Session->setFlash(__('The employee has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The employee could not be saved. Please, try again.'));
}
}
}
$customers = $this->Employee->modelname->find('list');
$this->set(compact('customers'));
并在view.ctp
echo $this->Form->input('access_level');
为
访问控制
添加下拉列表,其值为职员
和管理员
。
将其添加到员工控制器中
public function add() {
if ($this->request->is('post')) {
$this->Employee->create();
if ($this->Employee->save($this->request->data)) {
$this->Session->setFlash(__('The employee has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The employee could not be saved. Please, try again.'));
}
}
}
$customers = $this->Employee->modelname->find('list');
$this->set(compact('customers'));
并在view.ctp
echo $this->Form->input('access_level');
您可以使用例如-使用类常量。阅读上的文档,它有您的答案。您可以使用例如-使用类常量。阅读上的文档,它有您的答案。您可以使用例如-使用类常量。阅读上的文档,它有你的答案。你可以使用一个例子-使用类常量。阅读上的文档,它有你的答案。