pagination links will not work - codeigniter

On my users index page I am trying to set up the CI Pagination. But when I click on the 2nd link will load a error page "Unable to load page"; I have spent all day on it and will not load on the same page. I use hmvc I am not sure if that effects it?
How can I make it load on same page. As what most tutorials I have watched show. Like the tuts plus tutorial.
$config['base_url'] = 'http://localhost/codeigniter-project/';
URL http://localhost/codeigniter-project/admin/users/
Route $route['admin/users'] = "admin/user/users/index";
Controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Users extends MX_Controller {
public function __construct() {
parent::__construct();
$this->lang->load('admin/user/users', 'english');
$this->load->model('admin/user/users_model');
if (!$this->user->logged()) {
redirect('admin');
}
}
public function index() {
$this->document->setTitle($this->lang->line('heading_title'));
$data['heading_title'] = $this->lang->line('heading_title');
$this->load->library('setting');
$this->load->library('pagination');
$config = array();
$config["base_url"] = base_url('admin/users');
$config['total_rows'] = $this->db->get('user')->num_rows();
$config["per_page"] = $this->setting->get('config_limit_admin');
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$data['user'] = $this->db->get('user', $config["per_page"], $this->uri->segment(3));
return $this->load->view('user/users_list', $data);
}
}
View
<?php echo Modules::run('admin/common/header/index');?><?php echo Modules::run('admin/common/column_left/index');?>
<div id="content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<?php if ($this->session->flashdata('error')) { ?>
<div class="alert alert-danger"><i class="fa fa-times-circle"></i> <?php echo $this->session->flashdata('error');?></div>
<?php } ?>
<?php if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success"><i class="fa fa-check-circle"></i> <?php echo $this->session->flashdata('success');?></div>
<?php } ?>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title"><?php echo $heading_title; ?></h3></div>
<div class="panel-body">
<?php
echo '<div class="table-responsive">';
echo '<table class="table table-striped table-bordered table-hover">';
echo '<thead>';
echo '<tr>';
echo '<td class="text-center">' . "User ID" . '</td>';
echo '<td class="text-center">' . "Username" . '</td>';
echo '<td class="text-center">' . "Status" . '</td>';
echo '<td class="text-center">' . "Date Added" . '</td>';
echo '<td class="text-center">' . "Action" . '</td>';
echo '</tr>';
echo '</thead>';
foreach ($user->result() as $row) {
echo '<tbody>';
echo '<tr>';
echo '<td class="text-center">' . $row->user_id .'</td>';
echo '<td class="text-center">' . $row->username .'</td>';
echo '<td class="text-center">' . $row->status .'</td>';
echo '<td class="text-center">' . $row->date_added .'</td>';
echo '<td class="text-center">' . anchor("admin/users/edit/" . $row->user_id, '<div class="btn btn-primary text-right" role="button"><i class="fa fa-pencil"></i>
Edit</div>') .'</td>';
echo '</tr>';
echo '</tbody>';
}
echo '</table>';
echo '</div>';
echo '<div class="row">';
echo '<div class="col-sm-6 text-left">';
echo $this->pagination->create_links();
echo '</div>';
echo '</div>';
?>
</div><!-- . Panel Panel-Body -->
</div><!-- . Panel Panel-Default -->
</div><!-- . Columns -->
</div><!-- . Row -->
</div><!-- . Container-fluid-->
</div><!-- #Content -->
<?php echo Modules::run('admin/common/footer/index');?>

I just had a brain storm and added $route['admin/users/(:num)'] = "admin/user/users/index/$1"; and now links work.

Related

Pagination with Search Filter in CodeIgniter

When I search a keyword and paginate it, it returns data that matches the like query in the database.
A PHP Error was encountered
Severity: Warning
Message: count(): Parameter must be an array or an object that implements Countable
Filename: admin/view_member.php
Line Number: 105
Backtrace:
File: C:\xampp\htdocs\cms_new\application\views\admin\view_member.php
Line: 105
Function: _error_handler
File: C:\xampp\htdocs\cms_new\application\controllers\admin\Member.php
Line: 63
Function: view
File: C:\xampp\htdocs\cms_new\index.php
Line: 315
Function: require_once
MY Controller
$search = ($this->input->post("member_name"))? $this->input->post("member_name") : "NIL";
$search = ($this->uri->segment(3)) ? $this->uri->segment(3) : $search;
// pagination settings
$config = array();
$config['base_url'] = site_url("admin/member/index/$search");
$config['total_rows'] = $this->Model_member->record_count($search);
$config['per_page'] = "3";
$config["uri_segment"] = 4;
$choice = $config["total_rows"]/$config["per_page"];
$config["num_links"] = floor($choice);
// integrate bootstrap pagination
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = false;
$config['last_link'] = false;
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['prev_link'] = 'Prev';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = 'Next';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$this->pagination->initialize($config);
$data['page'] = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;
// get books list
$data['users'] = $this->Model_member->fetch_data($config['per_page'], $data['page'], $search);
$data['pagination'] = $this->pagination->create_links();
$this->load->view('admin/view_header',$data);
$this->load->view('admin/view_member',$data);
$this->load->view('admin/view_footer');
My Model
function fetch_data($limit, $start, $st = NULL)
{
if($st == "NIL")
$st = "";
$this->db->select('*');
$this->db->from('tbl_member');
$this->db->like('member_name', $st);
$this->db->or_like('member_email', $st);
$this->db->limit($limit, $start);
$query = $this->db->get();
if ($query->num_rows() > 0) {
//var_dump($query->result());
foreach ($query->result() as $row) {
$data[] = $row;
}
//print_r($query);
return $data;
}
if ($query->num_rows() == 0) {
$this->session->set_flashdata('recoard','<div class="alert alert-danger text-center">Record Not Found! </div>');
}
return false;
}
function record_count($st = NULL)
{
if($st == "NIL")
$st = "";
$this->db->select('*');
$this->db->from('tbl_member');
$this->db->like('member_name', $st);
$this->db->or_like('member_email', $st);
$query = $this->db->get();
return $query->num_rows();
var_dump($query->num_rows());
}
My View
<?php
$user = count($users);
var_dump($user);
for ($i = 0; $i < $user; ++$i) {
if(! $users ){
// Faild Message
echo $this->session->flashdata('recoard');
}
else {
?>
<tbody>
<tr>
<td class="text-center"><img class="rounded-circle img-fluid avatar-40" src="<?php echo base_url();; ?>public/uploads/<?php echo $users[$i]->member_photo; ?>" alt="profile"></td>
<td><?php echo $users[$i]->member_name; ?></td>
<td><?php echo $users[$i]->member_email; ?><br>
<?php echo $users[$i]->member_mobile; ?></td>
<td><?php echo $users[$i]->member_city; ?><br>
<?php echo $users[$i]->member_state; ?><br>
<?php echo $users[$i]->member_country; ?></td>
<td><?php echo $users[$i]->member_address; ?></td>
<td>
<?php
if($users[$i]->member_access == 1)
{
echo '<span class="badge iq-bg-primary">Active</span></td>';
}
else
{
echo '<span class="badge iq-bg-warning">Inactive</span></td>';
}
?>
</td>
<td>
<div class="flex align-items-center list-user-action">
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Change Status" href="<?php echo base_url(); ?>admin/member/change_status/<?php echo $users[$i]->member_id; ?>" onClick="return confirm('Are you sure?');"><i class="ri-user-add-line"></i></a>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit" href="<?php echo base_url(); ?>admin/member/edit/<?php echo $users[$i]->member_id; ?>"><i class="ri-pencil-line"></i></a>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete" href="<?php echo base_url(); ?>admin/member/delete/<?php $users[$i]->member_id; ?>" onClick="return confirm('Are you sure?');"><i class="iq-bg-danger ri-delete-bin-line"></i></a>
</div>
</td>
</tr>
</tbody>
<?php } } ?>
you seem to not be returning an array to count & loop over, this is why you have the warning.
Also you have the failed message inside your loop that will make more errors later on.
Hope this helps & works for you
<?php
if (!$users || !is_array($users)) {
// Faild Message
echo $this->session->flashdata('recoard');
} else {
foreach ($users as $user) { ?>
<tbody>
<tr>
<td class="text-center"><img class="rounded-circle img-fluid avatar-40" src="<?php echo base_url("public/uploads/"); ?><?php echo $user->member_photo; ?>" alt="profile"></td>
<td><?php echo $user->member_name; ?></td>
<td><?php echo $user->member_email; ?><br>
<?php echo $user->member_mobile; ?></td>
<td><?php echo $user->member_city; ?><br>
<?php echo $user->member_state; ?><br>
<?php echo $user->member_country; ?></td>
<td><?php echo $user->member_address; ?></td>
<td>
<?php
if ($user->member_access == 1) {
echo '<span class="badge iq-bg-primary">Active</span></td>';
} else {
echo '<span class="badge iq-bg-warning">Inactive</span></td>';
}
?>
</td>
<td>
<div class="flex align-items-center list-user-action">
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Change Status" href="<?php echo base_url(); ?>admin/member/change_status/<?php echo $user->member_id; ?>" onClick="return confirm('Are you sure?');"><i class="ri-user-add-line"></i></a>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit" href="<?php echo base_url(); ?>admin/member/edit/<?php echo $user->member_id; ?>"><i class="ri-pencil-line"></i></a>
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete" href="<?php echo base_url(); ?>admin/member/delete/<?php $user->member_id; ?>" onClick="return confirm('Are you sure?');"><i class="iq-bg-danger ri-delete-bin-line"></i></a>
</div>
</td>
</tr>
</tbody>
<?php }
} ?>

Live search in Laravel with Ajax

Hello team I failed to display data after type to the search button there is no error that displayed
Here is my controller
public function search(Request $request)
{
if ($request->ajax()) {
$output = "";
$products = DB::table('particulars')->where('item_name', 'LIKE', '%' . $request->search . "%")->get();
if ($products) {
foreach ($products as $key => $product) {
$output .= '<tr>' .
'<td>' . $product->id . '</td>' .
'<td>' . $product->item_name . '</td>' .
'<td>' . $product->quantity . '</td>' .
'<td>' . $product->price . '</td>' .
'</tr>';
}
return Response($output);
}
}
}
my view
<td>
<div class="row">
<div class="col-lg-12" style="">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-search"></span>
</div>
<input type="text" class="form-control" id="search" name="search" placeholder="Search here...">
</div>
</div>
</div>
</td>
Here is the script
<script type="text/javascript">
$('#search').on('keyup',function(){
$value=$(this).val();
$.ajax({
type : 'get',
url : '/search',
data:{'search':$value},
success:function(data){
$('tbody').html(data);
}
});
})
</script>
but I failed to retrieve data and show no error please team help me

Banner Images not being reinserted correct to database

When I update my banner_image it should delete the ones from the database Then re insert the ones that are set.
Currently what it does is deletes the banner image but then re inserts blank banner_image
But should remove that enitre row.
Question How to make sure when I update it that will remove the images rows that are no longer selected and not re insert them
public function update($bid = NULL, $data = array()) {
$banner_update = array('banner_title' => $data['banner_title'], 'banner_status' => $data['banner_status']);
$this->db->where('bid', $bid);
$this->db->update('banner', $banner_update);
$this->db->where('bid', $bid)->delete('banner_image');
if (isset($data['banner_image'])) {
$banner_images = array();
$i = 0;
foreach ($data['banner_image'] as $image) {
$banner_images[$i] = array(
'bid' => $bid,
'banner_image' => $image['image'],
);
$i++;
}
$this->db->insert_batch('banner_image', $banner_images);
}
}
View
<?php echo form_open($action);?>
<div class="container">
<div class="card mt-3">
<div class="card-body">
<?php if (validation_errors()) {?>
<?php unset($_POST);?>
<div class="bg-error-warning">
<ul>
<?php echo validation_errors('<li>', '</li>');?>
</ul>
</div>
<?php }?>
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p>Banner Title</p>
<div class="form-group">
<input type="text" name="banner_title" value="<?php echo $banner_title;?>" placeholder="Enter Banner Title" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
<table id="images" class="table table-striped table-bordered">
<tbody>
<tr>
<td>
<button type="button" onclick="addImage();" data-toggle="tooltip" title="Add Banner!" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button>
</td>
</tr>
<?php $image_row = 0; ?>
<?php foreach ($banner_images as $banner_image) { ?>
<tr id="image-row<?php echo $image_row; ?>">
<td>
<a href="" id="thumb-image<?php echo $image_row; ?>" data-toggle="image">
<img src="<?php echo $banner_image['thumb']; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" class="img-thumbnail"/></a>
<input type="hidden" name="banner_image[<?php echo $image_row; ?>][image]" value="<?php echo $banner_image['image']; ?>" id="input-image<?php echo $image_row; ?>" />
</td>
</tr>
<?php $image_row++; ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p>Banner Status</p>
<div class="form-group">
<?php $options = array('0' => 'Disabled', '1' => 'Enabled'); echo form_dropdown('banner_status', $options, $banner_status, array('class' => 'form-control'));?>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="form-group">
<button type="submit" class="btn btn-block btn-dark">Create Banner</button>
</div>
</div>
</div>
</div>
</div>
</div>
<?php echo form_close();?>
<script type="text/javascript">
var image_row = <?php echo $image_row; ?>;
function addImage() {
html = '<tr id="image-row' + image_row + '">';
html += '<td class="text-left">';
html += '<a href="" id="thumb-image' + image_row + '" data-toggle="image" >';
html += '<img src="<?php echo $placeholder; ?>" width="100" height="100" class="img-thumbnail" data-placeholder="<?php echo $placeholder; ?>"/>';
html += '<input type="hidden" name="banner_image[' + image_row + '][image]" value="" id="input-image' + image_row + '" />'
html += '</a>';
html += '</td>';
html += '<td class="text-left">';
html += '<button type="button" onclick="$(\'#image-row' + image_row + '\').remove();" data-toggle="tooltip" title="Remove Banner!" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button>'
html += '</td>';
html += '<script>';
html += '$(document).ready(function(){';
html += '$(\'[data-toggle="tooltip"]\').tooltip();';
html += '});';
html += '<\/script>';
$('#images tbody').append(html);
image_row++;
}
</script>
Have got it working just had to put empty in the foreach loop
public function update($bid = NULL, $data = array()) {
$banner_update = array('banner_title' => $data['banner_title'], 'banner_status' => $data['banner_status']);
// Updates the main banner table
$this->db->where('bid', $bid);
$this->db->update('banner', $banner_update);
// Removes banners so can have clean insert of new banners selected
$this->db->where('bid', $bid);
$this->db->delete('banner_image');
// Inserts new banner images & saved ones.
if ($this->input->post('banner_image')) {
foreach ($this->input->post('banner_image') as $image) {
if (!empty($image['image'])) {
$this->db->insert('banner_image', array('bid' => $bid, 'banner_image' => $image['image']));
}
}
}
}

if click default button address should be default

One user multiple shipping address how to make it as default,if click the make as default button,that address should be default and remaining all address shown the make as default button in a particular address box,except default address box.
view page
<?php foreach ($buyer_Address as $row) { ?>
<div class="col-md-4">
<div class="panel panel-default add_min_height">
<div class="panel-heading">Default:</div>
<input type="hidden" name="de" id="de" value="<?php echo $row->b_id; ?>">
<div class="panel-body">
<address><?php echo $row->b_fullname; ?><br>
<?php echo $row->b_street_address; ?>,<?php echo $row->b_locality ?>,<br>
<?php echo $row->b_landmark; ?>,
<?php echo $row->b_city; ?>, <?php echo $row->b_state; ?>,<?php echo $row->b_pincode; ?>
India
Phone number: <?php echo $row->b_mobile_number; ?></address>
</div>
<div class="panel-footer">
<a href="<?php echo base_url(); ?>index.php/welcome/buyereditaddress?id=<?php echo $row->b_id; ?>" >Edit</a>
<i class="fa fa-ellipsis-v"></i>
Delete
<i class="fa fa-ellipsis-v"></i>
<?php if ($row->status == '0') { ?>
<button type="submit" style="color:#337ab7;background: none !important;border: none;" name="default" id="default">Make as deafault</button>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
controller
public function defaultAddress() {
$id = $this->input->post('de');
$this->BuyerProfile_Model->defaultAddress($id);
redirect('welcome/buyeraddresses');
}
model
function defaultAddress($id) {
$this->db->trans_start();
$this->db->query("UPDATE buyer_order_address SET status = '0' WHERE b_id = '$id'");
$this->db->query("UPDATE buyer_order_address SET status = '1' WHERE b_id = '$id'");
$this->db->trans_complete();
}

Multidimensional input with codeigniter not setting second array correct

On my controller function get form I get my banner images and I also use multidimensional array in my view
For some reason, the second banner_image title not showing but the value has been placed on the first array instead?
print_r($_POST)
Question How am I able to make sure that no matter how many banner images I select it can set the multidimensional array correct for each post.
public function getForm()
{
$banner_id = $this->uri->segment(5);
if ($banner_id)
{
$data['action'] = 'admin/design/banners/edit/' . $banner_id;
} else {
$data['action'] = 'admin/design/banners/add';
}
$banner_info = $this->admin_model_banner->getBanner($banner_id);
if ($this->input->post('banner_name')) {
$data['banner_name'] = $this->input->post('banner_name');
} elseif (!empty($banner_info)) {
$data['banner_name'] = $banner_info['banner_name'];
} else {
$data['banner_name'] = '';
}
if ($this->input->post('banner_status')) {
$data['banner_status'] = $this->input->post('banner_status');
} elseif (!empty($banner_info)) {
$data['banner_status'] = $banner_info['status'];
} else {
$data['banner_status'] = '';
}
$banner_images = array();
$banner_images_post = $this->input->post('banner_image');
if (isset($banner_images_post)) {
$banner_images = $this->input->post('banner_image');
} elseif (isset($banner_id)) {
$banner_images = $this->admin_model_banner->getBannerImages($banner_id);
}
$data['banner_images'] = array();
foreach ($banner_images as $banner_image)
{
if (is_file(FCPATH . 'image/' . $banner_image['image'])) {
$image = $banner_image['image'];
$thumb = $banner_image['image'];
} else {
$image = '';
$thumb = 'catalog/no_image.jpg';
}
$data['banner_images'][] = array(
'image' => $image,
'thumb' => $this->model_tool_image->resize($thumb, 100, 100),
'title' => $banner_image['title'],
'sort_order' => $banner_image['sort_order']
);
}
$data['placeholder'] = $this->model_tool_image->resize('catalog/no_image.jpg', 100, 100);
$data['header'] = Modules::run('admin/common/header/index');
$data['footer'] = Modules::run('admin/common/footer/index');
$this->load->view('design/banner_form_view', $data);
}
View
<?php echo $header;?>
<div class="container">
<?php
$form = array(
'id' => '',
'role' => 'form',
'class' => 'form-horizontal'
);
echo form_open_multipart($action, $form);?>
<div class="panel panel-default">
<div class="panel-heading"></div>
<div class="panel-body">
<div class="form-group">
<label class="col-lg-2">Banner Status</label>
<div class="col-lg-10">
<input type="text" name="banner_name" class="form-control" placeholder="Enter Banner Name" value="<?php echo $banner_name;?>" size="50"/>
<?php echo form_error('banner_name', '<div class="text-danger" style="margin-top: 2rem;">', '</div>'); ?>
</div>
</div>
<div class="form-group">
<label class="col-lg-2">Banner Name</label>
<div class="col-lg-10">
<?php
$options = array('1' => 'Enabled', '0' => 'Disabled');
echo form_dropdown('banner_status', $options, $banner_status, array('class' => 'form-control'));
?>
</div>
</div>
<table id="images" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="text-left">Title</td>
<td class="text-left">Image</td>
<td>Sort Order</td>
</tr>
</thead>
<tbody>
<?php $image_row = 0; ?>
<?php foreach ($banner_images as $banner_image) { ?>
<tr id="image-row<?php echo $image_row; ?>">
<td class="text-left">
<input type="text" name="banner_image[<?php echo $image_row; ?>][title]" value="<?php echo $banner_image['title']; ?>" class="form-control">
</td>
<td class="text-left">
<a href="" id="thumb_image_<?php echo $image_row; ?>" data-toggle="image" class="img-thumbnail">
<img src="<?php echo $banner_image['thumb']; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" />
</a>
<input type="hidden" name="banner_image[<?php echo $image_row; ?>][image]" value="<?php echo $banner_image['image']; ?>" id="input_image_<?php echo $image_row; ?>" /></td>
<td class="text-right"><input type="text" name="banner_image[<?php echo $image_row; ?>][sort_order]" value="<?php echo $banner_image['sort_order']; ?>" placeholder="Sort Order" class="form-control" /></td>
<td class="text-left">
<button type="button" onclick="$('#image-row<?php echo $image_row; ?>').remove();" class="btn btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></button></td>
</tr>
<?php $image_row++; ?>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td class="text-left">
<button type="button" onclick="addImage();" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button>
</td>
</tr>
</tfoot>
</table>
</div>
<div class="panel-footer">
<div class="text-right"><button type="submit" class="btn btn-primary"><i class="fa fa-floppy-o" aria-hidden="true"></i> Save</button></div>
</div>
</div>
<?php echo form_close();?>
</div>
<script type="text/javascript">
var image_row = <?php echo $image_row; ?>;
function addImage()
{
html = '<tr id="image-row' + image_row + '">';
html += '<td class="text-left">';
html += '<input type="text" name="banner_image[<?php echo $image_row; ?>][title]" class="form-control" value="">';
html += '</td>';
html += '<td class="text-left">';
html += '<a href="" id="thumb_image_' + image_row + '" data-toggle="image" class="img-thumbnail">';
html += '<img src="<?php echo $placeholder; ?>" data-placeholder="<?php echo $placeholder; ?>"/>';
html += '</a>';
html += '<input type="hidden" name="banner_image[' + image_row + '][image]" value="" id="input_image_' + image_row + '" />';
html += '</td>';
html += '<td class="text-right">';
html += '<input type="text" name="banner_image[' + image_row + '][sort_order]" value="" placeholder="Sort Order" class="form-control" />';
html += '</td>';
html += '</tr>';
$('#images tbody').append(html);
image_row++;
}
</script>
Solved
After doing some investigation I found problem was to do with
name="banner_image[<?php echo $image_row; ?>][title]"
On script, I forgot to add it like
name="banner_image[' + image_row + '][title]"
Working now

Resources