dongxia4880 2018-09-11 05:25
浏览 83

set_checkbox值未返回

[enter image description here][1]i want repopulate my form using edit button once i clicked edit button it ll shows what are all the selected items are to be displayed

<input type="checkbox" id="mycheck1" name="certid[]" 
  value="1" class="cbx"  <?php echo set_checkbox('certid','1');?>

Controller

   $data['getcert'] = $this->User_Model->getcert();

  output should be in the form of array 

   Array
  (
  [id] => 1
  [certificate_id] => 1
  [fee] => 500
  [APPNO] => 10001
  [regno] => 01107402042
  [certid] => 1
  [noc] => 2
  [paid] => 1000
  )


 <?php foreach($getcert as $student){ 
   echo '<pre>';
    print_r($student);
    echo '</pre>';
    ?>
 <td width="50px" align="center">1</td>
 <td>Transcripts  & Degree Certificate Attestation</td>
  <td align="center"><input type="checkbox" id="mycheck1" name="certid[]" 
   value="<?php echo (!isset($student['certid'])) ? 1 : $student['certid'] 
      ?>"
    class="cbx"  <?php echo set_checkbox('certid[]','1');?> ></td>
     <td> 500 </td>
    <td> <input type="number" id="primaryincome1"  min="1"  max="999" 
 name="noc[]" 
   value="<?php echo (!isset($student['noc'])) ? '' : $student['noc'] ?>"
   disabled> </td>
  <div class="col-xs-2">
    <td ><input type="text" id="totalamountremaining1"  name="txt" 
    class="text-right" value="<?php echo (!isset($student['paid'])) ? 0 : 
     $student['paid'] ?>"  size="5"></td>
      </div>

    that certid value only be placed in checkbox

This values are stored in db .how to assign that value in this view?

  • 写回答

3条回答 默认 最新

  • dongliao6491 2018-09-11 06:37
    关注

    This is not direct answers to your question but you will get an idea how to do this.

    In the HTML:

    <input type="hidden" name="certid" value="<?php print base64_encode(serialize($result)); ?>">
    

    And in the controller:

    $data = unserialize(base64_decode($this->input->post('certid')));
    

    Using this method you can pass the array data from the frontend to your controller.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100