I am Developing a Blog Application with Codeigniter. Its style depends on Bootstrap 3. I created a table to show articles of users. i also created a row for taking actions on that article. I created a form submit buttom using form_submit()
Function of codeigniter form helper. But as i said its a button group so i also have two more button (one before it and one after it). I want to style this form submit as a button of button group but now it is looking as whole new button. Here's my Code.
This is my Whole View.
<?php
include_once('admin_header.php');
?>
<div class="container">
<div class="row">
<?= anchor('admin/store_article', 'Add Post', ["class"=>"btn btn-primary btn-large pull-right"]); ?>
</div>
<?php
if ($feedback = $this->session->flashdata('feedback')) :
$feedback_class = $this->session->flashdata('feedback_class'); ?>
<br>
<br>
<br>
<div class="alert alert-dismissible <?= $feedback_class ?>">
<?= $feedback ?>
</div>
<?php endif; ?>
<div class="table-responsive">
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>Sr NO.</th>
<th>Article</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if(count($articles)):
$count = $this->uri->segment(3, 0);
foreach ($articles as $article):
?>
<tr>
<td><?= ++$count ?></td>
<td>
<?= $article->title; ?>
</td>
<td>
<div class="btn-group">
<?= anchor("plogi/article/{$article->id}", 'View', ['class'=>'btn btn-success']) ?>
<?= anchor("admin/edit_article/{$article->id}", "Edit", ["class"=>"btn btn-primary"]); ?>
<?=
form_open('admin/delete_article', ['class'=>'form-horizontal danger']);
echo form_hidden('article_id', $article->id);
echo form_Submit(['type'=>'submit', 'value'=>'Delete', 'class'=>'btn btn-danger']);
echo form_close();
?> <div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
More <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Re Share</a></li>
<li><a href="#">Purge From Cache</a></li>
</ul>
</div>
</div></td>
</tr>
<?php
endforeach;
else:
echo "<tr><td colspan='3'>No Records Found</td></tr>";
endif;
?>
</tbody>
</table>
<?= $this->pagination->create_links(); ?>
</div>
</div>
<?php
include_once('admin_footer.php');
?>
This is My Model.
public function delete_article($article_id)
{
return $this->db->delete('articles', ['id'=> $article_id]);
}
And this is my controller
public function delete_article()
{
$article_id = $this->input->post('article_id');
$this->load->model('articlesmodel', 'articles');
if ($this->articles->delete_article($article_id)) {
$this->session->set_flashdata('feedback', 'Post Deleted Successfully');
$this->session->set_flashdata('feedback_class', 'alert-success');
} else {
$this->session->set_flashdata('feedback', 'Failed To Delete Post, Please Try Again');
$this->session->set_flashdata('feedback_class', 'alert-danger');
}
return redirect('admin/dashboard');
}
Now it is Looking like