我已经阅读了很多这样的帖子,但未能找到我的特殊情况。尝试删除选中的复选框。现在您可以提交表单,它会将您带到所有正确的页面,但实际上并没有删除任何内容。
这是我的控制器信息
function deleteFolder() {
if(array_key_exists('deleteMe',$_POST)) {
$checkbox = $this->input->post['checkbox'];
$this->index_model->deleteFolder($checkbox);
}
$this->folderdeleted();
}
这是我的模型
function deleteFolder($checkbox) {
$this->db->where('folderName', 'folderName');
$this->db->delete('senior', $checkbox);
return;
}
这是我的看法
<!DOCTYPE html>
<?php $this->load->view('partials/page_head'); ?>
<body>
<div id="container">
<div id="top">
<div class="topcenter">
<h2><a class="homebtn" href="<?php echo base_url();?>">Home</a></h2>
</div>
<div class="navdescription"><span>Delete Page</span></div>
</div>
<div class="projectFolders">
<?php foreach($foldername as $row) { ?>
<div class="folder">
<button><?php echo $row->folderName; ?></button>
<div class="delete">
<form name="delete" method="post" action="<?php echo base_url(); ?>index.php/home/folderdeleted">
<p>
<input type = "checkbox" id = "check_<?php echo $row->folderName; ?>"/>
<?php echo form_submit('deleteFolder', 'Delete'); ?>
</p>
</form>
</div>
</div>
<?php } ?>
</div>
</div><!-- End of container div -->
</body>
</html>