public function edit_client_registration_details($c_id,$id)
{
$data['active_mn']="user_registration_details";
$fileName = $this->input->post('fileName');
//var_dump($fileName);
$file = $this->input->post('files');
//var_dump($file);
if (!empty($fileName)) {
foreach ($fileName as $key => $name) {
//$old['fileName'] = $name;
$result[] = $name;
}
$documents = json_encode($result);
}
if (!empty($_FILES['files']['name']['0'])) {
$old_path_info = $this->input->post('fileName');
$mul_val = $this->do_upload('documents');
var_dump($mul_val);
$documents = json_encode($mul_val);
}
if (!empty($result) && !empty($mul_val)) {
$file = array_merge($result, $mul_val);
$documents = json_encode($file);
}
$data=array(
'service_name' =>$this->input->post('service_name'),
'service_number' =>$this->input->post('service_no'),
'expiry_date' =>$this->input->post('date'),
'link' =>$this->input->post('link'),
'documents'=>$documents,
);
$update=$this->Admin_model->update_service($c_id,$data);
if($update)
{
$this->session->set_flashdata('success','Reg Details Updated Successfully');
redirect('admin/add-client-registration-details/'.$id);
}
else
{
$this->session->set_flashdata('error','Failed');
redirect('admin/add-client-registration-details/'.$id);
}
}
Here is my code,in this the values that are appended are not getting in the form and the values are not passing to the database.I got the appended view correctly but the values selected in that append
function are not getting.
Here is my script
var maxAppend = 0;
$(document).on('click', '.update_more', function() {
var u_id = $(this).attr("u_id");
var add_new = $('<div class="form-group" style="margin-bottom: 0px">
\
<label for="field-1" class="col-sm-4 control-label">Document</label>
\
<div class="col-sm-5">
\
<div class="fileinput fileinput-new" data-provides="fileinput">
\
<span class="btn btn-default btn-file"><span class="fileinput-new" >Select file</span><span class="fileinput-exists" >Change</span><input type="file" name="files[]" ></span> <span class="fileinput-filename"></span><a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none;">×</a></div></div>
\<div class="col-sm-2">
\<strong>
\
<a href="javascript:void(0);" class="remCF"><i class="fa fa-times"></i> Remove</a></strong></div>');
maxAppend++;
var resil = $(this).closest("#update_new_" + u_id).append(add_new);
console.log(resil);
});
<form method="post" class="form_<?php echo $value->id;?>" action="<?php echo base_url();?>admin/edit-client-registration-details/<?= $value->id; ?>/<?= $id; ?>" enctype="multipart/form-data">
<div id="update_new_<?php echo $value->id;?>" class="update_new_<?php echo $value->id;?> item-row">
<div class="form-group mb0" style="margin-bottom: 0px">
<label for="field-1" class="col-sm-4 control-label">Other Document</label>
<div class="col-sm-5">
<div class="fileinput fileinput-new" data-provides="fileinput">
</div>
<div id="msg_pdf" style="color: #e11221"></div>
</div>
<div class="col-sm-3">
<strong>
<a href="javascript:void(0);" id="update_more" onclick="add_field('<?php echo $value->id;?>');" u_id="<?php echo $value->id;?>" class="addCF item-row-click update_more">
<i class="fa fa-plus">
</i>
Add More</a>
</strong>
</div>
</div>
</div>
</form>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</div>