doushi1957 2019-05-16 11:51
浏览 82

在提交时,附加值不会形成

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;">&times;</a></div></div>
\<div class="col-sm-2">
\<strong>
\
<a href="javascript:void(0);" class="remCF"><i class="fa fa-times"></i>&nbsp;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>
          &nbsp;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>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab生成电测深三层曲线模型代码
    • ¥50 随机森林与房贷信用风险模型
    • ¥50 buildozer打包kivy app失败
    • ¥30 在vs2022里运行python代码
    • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
    • ¥15 求解 yolo算法问题
    • ¥15 虚拟机打包apk出现错误
    • ¥15 用visual studi code完成html页面
    • ¥15 聚类分析或者python进行数据分析
    • ¥15 三菱伺服电机按启动按钮有使能但不动作