我想检查市场的数量,如果是真的数量然后删除并重定向索引,否则重定向错误
控制器中的:
public function admin_verif_num() {
$this->set('title_for_layout', __('verification'));
$this->Market->recursive = 2;
$markets = $this->Market->find('list', array(
'fields' => array('Market.num_mark')
));
if (!empty($this->request->data)) {
$num= $this->request->data['Market']['num_mark'];
foreach ($markets as $nums) {
if ($nums == $num) {
$id= $this->request->id;
$this->Session->setFlash(__('good'), 'default', array('class' => 'success'));
$this->redirect(array('action' => 'delete',$id,true), null, __('Are you sure?'));
} else{
$this->Session->setFlash(__('error'), 'default', array('class' => 'success'));
$this->redirect(array('action' => 'admin_verif_delete_num'));
}
}
}
$this->set('markets', $markets);
}
在视图中:
<?php
echo $this->Form->label('num_mark', ' : طلب الع'); ?>
<?php echo $this->Form->input('num_mark',array('label' => false ));
?>
结果为http://localhost/bib/admin/markets/delete/1
但不删除什么是真正的代码?