Codeigniter - Get the value of Checkboxes and display it on the another page -


i newbie here in code igniter, i'm having problem of getting checked values in checkboxes, , don't know how display on other view ...

here's code

view

<?php foreach($sen_votes $sen) { ?>    <?php echo form_open("votation/balot_form"); ?>    <div class="col-md-6">      <center><div class="featurette panel panel-info" id="about">    <div class="form-group">       <div class="form-section">            <label class="form-label--tick col-md-12">             <div class="col-md-6">               <img class="img-hov img-responsive" src="<?php echo base_url();?>webroot/assets/img/faces/face-2.jpg" id="" height ="120px" width = "120px"  />              </div>         <div class="col-md-6">                                       <input type="radio" id="" name="sen[]" class="form-label-radio" value="<?php echo $sen['id']; ?>" onclick="myfunction()" required = "" />                                           <span class="form-label-text"></span>   </label>     </div>  </div>  </div>                                        <h5 class="text text-default">   <strong> &nbsp;name:</strong> <?php echo $sen['fullname']; ?><br>   <strong> &nbsp;party name:</strong> <?php echo $sen['party_name']; ?><br>   <strong> &nbsp;votes:</strong> <?php echo $sen['votes']; ?></h5>  </div>  </center>  </div>  <?php } ?>   <div class="row">     <div class="col-md-12">       <div class="form-group">         <button type="submit" class="btn btn-info btn-fill pull-right">next <i class ="fa fa-arrow-right"></i></button>       </div>                                    </div><br>  </div>  <?php echo form_close(); ?>

here's controller want values

public function balot_form(){        //senators         $sen_id = $this->input->post('sen_id[]');     	   $view_sen_votes = $this->vote->view_sen($sen_id);  			         $data = array("view_sen_votes" => $view_sen_votes);       	    $this->load->view("admin_dashboard/votation_page/balot_form_page", $data);      }

my model

public function view_sen($sen_id){    	   $sen_id = implode(', ', $this->input->post('sen_id'));                $this->db->select('*')->from('party_candidates')->where('id', $sen_id);  	      $query = $this->db->get()->result_array();  return $query;  					  }

heres page want display selected senators

<div class="col-md-6">    <?php foreach($view_sen_votes $sen) : ?>     <div class="row">       <div class="col-md-12">         <div class="form-group">      <label>senators</label>         <input type="text" class="form-control" placeholder="" value="<?php echo $sen['id']; ?>" name="sen_id[]" required="" />                                                             </div>                </div>      <div class="col-md-6"></div>       </div>    <?php endforeach; ?>  </div>

thank :)

try this

in controller

public function balot_form(){      $sen_id[] = $_post['sen_id'];        $view_sen_votes = $this->vote->view_sen($sen_id);            $data = array("view_sen_votes" => $view_sen_votes);     $this->load->view("admin_dashboard/votation_page/balot_form_page", $data); } 

in model

public function view_sen($sen_id){      $sen_id[] = $_post['sen_id'];      foreach ($sen_id $id => $value) {         $this->db->select('*')->from('party_candidates')->where('id', $value);         $query[] = $this->db->get()->result_array();     }        return $query;                   } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -